BASE: prevent exception in ir_cron
bzr revid: ced-679cd2ff62f8d26ce52ef443a64d5e5c120afcd9
This commit is contained in:
parent
758395dbec
commit
a82d1dbb4e
|
@ -92,8 +92,10 @@ class ir_cron(osv.osv, netsvc.Agent):
|
||||||
|
|
||||||
def _callback(self, cr, uid, model, func, args):
|
def _callback(self, cr, uid, model, func, args):
|
||||||
args = (args or []) and eval(args)
|
args = (args or []) and eval(args)
|
||||||
f = getattr(self.pool.get(model), func)
|
m=self.pool.get(model)
|
||||||
f(cr, uid, *args)
|
if m and hasattr(func, m):
|
||||||
|
f = getattr(m, func)
|
||||||
|
f(cr, uid, *args)
|
||||||
|
|
||||||
def _poolJobs(self, db_name, check=False):
|
def _poolJobs(self, db_name, check=False):
|
||||||
now = DateTime.now()
|
now = DateTime.now()
|
||||||
|
@ -122,8 +124,7 @@ class ir_cron(osv.osv, netsvc.Agent):
|
||||||
addsql=''
|
addsql=''
|
||||||
if not numbercall:
|
if not numbercall:
|
||||||
addsql = ', active=False'
|
addsql = ', active=False'
|
||||||
cr.execute("update ir_cron set nextcall=%s, numbercall=%d"+addsql+" where id=%d",
|
cr.execute("update ir_cron set nextcall=%s, numbercall=%d"+addsql+" where id=%d", (nextcall.strftime('%Y-%m-%d %H:%M:%S'), numbercall, job['id']))
|
||||||
(nextcall.strftime('%Y-%m-%d %H:%M:%S'), numbercall, job['id']))
|
|
||||||
cr.commit()
|
cr.commit()
|
||||||
finally:
|
finally:
|
||||||
cr.close()
|
cr.close()
|
||||||
|
|
Loading…
Reference in New Issue