diff --git a/Makefile b/Makefile
index 39ab146c13a..7b410d19dee 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,7 @@
# -*- makefile -*-
addons-path := bin/addons/
+extra-addons:= ''
root-path := bin/
port := 8069
net_port := 8070
@@ -22,7 +23,7 @@ drop-db:
python $(interrogation_file) drop-db --database=$(database) --root-path=$(root-path) --addons-path=$(addons-path) --port=$(port)
install-module:
- python $(interrogation_file) install-module --modules=$(module) --database=$(database) --root-path=$(root-path) --addons-path=$(addons-path) --port=$(port) --login=$(login) --password=$(password)
+ python $(interrogation_file) install-module --modules=$(module) --database=$(database) --root-path=$(root-path) --addons-path=$(addons-path) --extra-addons=$(extra-addons) --port=$(port) --login=$(login) --password=$(password)
upgrade-module:
python $(interrogation_file) upgrade-module --modules=$(module) --database=$(database) --root-path=$(root-path) --addons-path=$(addons-path) --port=$(port) --login=$(login) --password=$(password)
diff --git a/bin/addons/base/ir/ir_cron.py b/bin/addons/base/ir/ir_cron.py
index 7da956c36af..166a5781d44 100644
--- a/bin/addons/base/ir/ir_cron.py
+++ b/bin/addons/base/ir/ir_cron.py
@@ -27,8 +27,6 @@ import tools
import pooler
from osv import fields,osv
-next_wait = 60
-
_intervalTypes = {
'work_days': lambda interval: DateTime.RelativeDateTime(days=interval),
'days': lambda interval: DateTime.RelativeDateTime(days=interval),
@@ -74,20 +72,18 @@ class ir_cron(osv.osv, netsvc.Agent):
f = getattr(m, func)
f(cr, uid, *args)
- def _poolJobs(self, db_name, check=False):
+ def _poolJobs(self, db_name, check=False):
try:
db, pool = pooler.get_db_and_pool(db_name)
except:
- return False
-
+ return False
if pool._init:
# retry in a few minutes
- next_call = 600
+ next_call = 600
else:
- next_call = next_wait
- cr = db.cursor()
now = DateTime.now()
try:
+ cr = db.cursor()
cr.execute('select * from ir_cron where numbercall<>0 and active and nextcall<=now() order by priority')
for job in cr.dictfetchall():
nextcall = DateTime.strptime(job['nextcall'], '%Y-%m-%d %H:%M:%S')
@@ -115,8 +111,32 @@ class ir_cron(osv.osv, netsvc.Agent):
# Can be improved to do at the min(min(nextcalls), time()+next_call)
# But is this an improvement ?
#
+ cr = db.cursor()
+ cr.execute('select min(nextcall) as min_next_call from ir_cron where numbercall<>0 and active and nextcall>=now()')
+ next_call = cr.dictfetchone()['min_next_call']
+ cr.close()
+ if next_call:
+ next_call = time.mktime(time.strptime(next_call, '%Y-%m-%d %H:%M:%S'))
+ else:
+ next_call = int(time.time()) + 3600 # if do not find active cron job from database, it will run again after 1 day
if not check:
- self.setAlarm(self._poolJobs, int(time.time()) + next_call, db_name, db_name)
+ self.setAlarm(self._poolJobs, next_call, db_name, db_name)
+
+ def create(self, cr, uid, vals, context=None):
+ res = super(ir_cron, self).create(cr, uid, vals, context=context)
+ cr.commit()
+ self._poolJobs(cr.dbname)
+ return res
+ def write(self, cr, user, ids, vals, context=None):
+ res = super(ir_cron, self).write(cr, user, ids, vals, context=context)
+ cr.commit()
+ self._poolJobs(cr.dbname)
+ return res
+ def unlink(self, cr, uid, ids, context=None):
+ res = super(ir_cron, self).unlink(cr, uid, ids, context=context)
+ cr.commit()
+ self._poolJobs(cr.dbname)
+ return res
ir_cron()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/bin/addons/base/rng/view.rng b/bin/addons/base/rng/view.rng
index 78944519593..d69c09df72a 100644
--- a/bin/addons/base/rng/view.rng
+++ b/bin/addons/base/rng/view.rng
@@ -378,6 +378,7 @@