Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ALL] ir.cron nextcall: not working properly on a localized server #59938

Open
Shide opened this issue Oct 14, 2020 · 0 comments
Open

[ALL] ir.cron nextcall: not working properly on a localized server #59938

Shide opened this issue Oct 14, 2020 · 0 comments

Comments

@Shide
Copy link
Contributor

Shide commented Oct 14, 2020

now = fields.Datetime.context_timestamp(cron, datetime.now())

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 resulting line will be like this:

now = fields.Datetime.context_timestamp(cron, datetime.utcnow()) 
@Shide 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 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 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant