From a9a50c2cc8aaec83ee6b7e437cef87a991ab5d4a Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Thu, 29 Sep 2011 00:46:11 +0200 Subject: [PATCH] [FIX] ir_cron: compare timestamps always as UTC (as of v6.1) bzr revid: odo@openerp.com-20110928224611-51eqnelo7mqomnwh --- openerp/addons/base/ir/ir_cron.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openerp/addons/base/ir/ir_cron.py b/openerp/addons/base/ir/ir_cron.py index e4f78e84b74..5d1addd29da 100644 --- a/openerp/addons/base/ir/ir_cron.py +++ b/openerp/addons/base/ir/ir_cron.py @@ -167,7 +167,8 @@ class ir_cron(osv.osv): addsql = '' if not numbercall: addsql = ', active=False' - cr.execute("UPDATE ir_cron SET nextcall=%s, numbercall=%s"+addsql+" WHERE id=%s", (nextcall.strftime(DEFAULT_SERVER_DATETIME_FORMAT), numbercall, job['id'])) + cr.execute("UPDATE ir_cron SET nextcall=%s, numbercall=%s"+addsql+" WHERE id=%s", + (nextcall.strftime(DEFAULT_SERVER_DATETIME_FORMAT), numbercall, job['id'])) if numbercall: # Reschedule our own main cron thread if necessary. @@ -198,9 +199,10 @@ class ir_cron(osv.osv): try: jobs = {} # mapping job ids to jobs for all jobs being processed. now = datetime.now() + # Careful to compare timestamps with 'UTC' - everything is UTC as of v6.1. cr.execute("""SELECT * FROM ir_cron WHERE numbercall != 0 - AND active AND nextcall<=now() + AND active AND nextcall <= (now() at time zone 'UTC') ORDER BY priority""") for job in cr.dictfetchall(): if not openerp.cron.get_thread_slots():