Hello,
I'm new to Odoo I have problem with simple cron job that all it has to do is to update a single field, but can't make it done. Basically when I call this function from cron job does't have any records. What should I do to access my records? Please be more specific :)
Here is my model:
@api.model
def being_created(self):
for rec in self:
delta = datetime.now() - rec.create_date
# if delta.days == 1:
# rec.created = f'{delta.days} day ago'
# else:
# rec.created = f'{delta.days} days ago'
rec.created = delta
And my cron XML:
<odoo>
<data noupdate="1">
<record id="BeingCreated_cron" forcecreate='True' model="ir.cron">
<field name="name">Being Created</field>
<field eval="True" name="active"/>
<field name="user_id" ref="base.user_root"/>
<field name="interval_number">1</field>
<field name="interval_type">minutes</field>
<field name="numbercall">-1</field>
<field name="model_id" ref="model_clients_clients"/>
<field name="state">code</field>
<field name="code">model.being_created()</field>
</record>
</data>
</odoo>
Thanks and have a great day!