'How to set timezone when executing odoo cron schedule action once a day
In my odoo module I have created scheduled action with cron that must be executed once a day at a certain hour (15:20). But the action is running two hours late. Maybe this is related to the timezone. The timezone of the server is Europe/Madrid. The hour is vie 08 abr 2022 04:35:52 CEST.
How can I fix this?
Here is my code
<record id="cron_read_asp_15_files" model="ir.cron">
<field name="name">Portabilidad Read ASP 15 R files </field>
<field name="active" eval="True" />
<field name="user_id" ref="base.user_root" />
<field name="interval_number">1</field>
<field name="numbercall">-1</field>
<field name="doall">-1</field>
<field ref="model_portabilidad_request" name="model_id" />
<field name="state">code</field>
<field name="code">model.action_read_asp_15_files()</field>
<field eval="False" name="doall"/>
<field name="function">True</field>
<field name="nextcall" eval="(DateTime.now() + timedelta(days=1)).strftime('%Y-%m-%d 15:20:00')" />
<field name="interval_type">days</field>
</record>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
