You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this line we pass a local datetime to the fields.Datetime.context_timestamp function. If we have a localized server, we will have problems if our CRON increment is less than a day (minutes or hours).
Passing datetime.utcnow() to fields.Datetime.context_timestamp function, will ensure the correct behavior on all server configurations.
fields.Datetime.context_timestamp function must receive an UTC naive datetime.
When our server is localizated, datetime.now() don't have timezone (is naive), but the datetime is on local timezone. If we use datetime.utcnow(), will be naive too and the date will be on utc (the right value for fields.Datetime.context_timestamp)
The text was updated successfully, but these errors were encountered:
Shide
changed the title
CRON nextcall not working properly under a day increment
CRON nextcall not working properly under a day increment on a localized server
Oct 14, 2020
Shide
changed the title
CRON nextcall not working properly under a day increment on a localized server
CRON nextcall not working properly on a localized server
Oct 14, 2020
Shide
changed the title
CRON nextcall not working properly on a localized server
[ALL] ir.cron nextcall: not working properly on a localized server
Oct 14, 2020
odoo/odoo/addons/base/models/ir_cron.py
Line 136 in 1527db8
In this line we pass a local datetime to the
fields.Datetime.context_timestamp
function. If we have a localized server, we will have problems if our CRON increment is less than a day (minutes or hours).Passing
datetime.utcnow()
tofields.Datetime.context_timestamp
function, will ensure the correct behavior on all server configurations.fields.Datetime.context_timestamp
function must receive an UTC naive datetime.When our server is localizated,
datetime.now()
don't have timezone (is naive), but the datetime is on local timezone. If we usedatetime.utcnow()
, will be naive too and the date will be on utc (the right value forfields.Datetime.context_timestamp
)The resulting line will be like this:
The text was updated successfully, but these errors were encountered: