Comment 7 for bug 677257

Revision history for this message
Ghislain Nebra (INCB) (ghislain-nebra-3) wrote :

I would also add that in _poolJos function, sql requests are using "now()" of Postgre whereas in the if statement, the "DateTime.now()" of Python is used.
Only one "now" origin should be used : the Python one.

Here is my suggestion :
cr.execute("select * from ir_cron where numbercall<>0 and active and nextcall<=now() order by priority")
should be
cr.execute("select * from ir_cron where numbercall<>0 and active and nextcall<='" + now.strftime('%Y-%m-%d %H:%M:%S') + "' order by priority")

This is very important if your PostgreSQL database is not on the same computer than the OpenERP server because a small difference in clock could lead to non-working cron jobs.

Moreover in this function, the "while nextcall < now and numbercall:" should be "while nextcall <= now and numbercall:" because if the cron job is planned at 1:00, the timer will wake up at 1:00 ... and you want your cron job to be executed !