Community mailing list archives

community@mail.odoo.com

ir_cron update nextcall timestamp error in winows odoo env, may be a bug of ir.cron

by
wade wang
- 08/14/2015 04:14:55

Today, I found that after every ir.cron task executed, the timestamp nextcall will update to more 8 hours than correct timestamps. My time zone is asia shanghai, east 8 zone.

 

I checked the code in ir_cron.py line 162:

                now = fields.datetime.context_timestamp(job_cr, job['user_id'], datetime.now())

e.i: the local time is 2015-08-14 15:32:34.422988, then

datetime.now() is same with local time, 2015-08-14 15:32:34.422988

 

so, after context_timestamp with tz +8, the now is  2015-08-14 23:32:34.422988+08:00

 

it is wrong!

 

Then I do the same test on odoo linux env, it works well.

 

At last, I just print datetime.now() in linux python interpret,  the result same with in windows.

 

To resolve this problem, I change the datetime.now() to datetime.utcnow(), it works both windows and linux odoo!

 

Is it a bug of ir.cron?

 

Thanks

 

Wade, Wang

 

Shanghai, China

Oscg