[MERGE] forward port branch 8.0 up to 775022e01f

This commit is contained in:
Christophe Simonis
2017-03-01 11:26:31 +01:00
4 changed files with 31 additions and 17 deletions
+2 -1
View File
@@ -802,7 +802,8 @@ class mrp_production(osv.osv):
proc_obj = self.pool.get("procurement.order") proc_obj = self.pool.get("procurement.order")
procs = proc_obj.search(cr, uid, [('production_id', 'in', ids)], context=context) procs = proc_obj.search(cr, uid, [('production_id', 'in', ids)], context=context)
if procs: if procs:
proc_obj.message_post(cr, uid, procs, body=_('Manufacturing order cancelled.'), context=context) for proc in procs:
proc_obj.message_post(cr, uid, proc, body=_('Manufacturing order cancelled.'), context=context)
proc_obj.write(cr, uid, procs, {'state': 'exception'}, context=context) proc_obj.write(cr, uid, procs, {'state': 'exception'}, context=context)
return True return True
+11
View File
@@ -0,0 +1,11 @@
Spain, 2017-02-27
I hereby agree to the terms of the Odoo Individual Contributor License
Agreement v1.0.
I declare that I am authorized and able to make this agreement and sign this
declaration.
Signed,
Isaac Gallart Bochons igallart@puntsistemes.es https://github.com/igallart
+12 -14
View File
@@ -198,20 +198,20 @@ class ir_cron(osv.osv):
""" """
db = openerp.sql_db.db_connect(db_name) db = openerp.sql_db.db_connect(db_name)
threading.current_thread().dbname = db_name threading.current_thread().dbname = db_name
cr = db.cursor()
jobs = [] jobs = []
try: try:
# Make sure the database we poll has the same version as the code of base with db.cursor() as cr:
cr.execute("SELECT 1 FROM ir_module_module WHERE name=%s AND latest_version=%s", ('base', BASE_VERSION)) # Make sure the database we poll has the same version as the code of base
if cr.fetchone(): cr.execute("SELECT 1 FROM ir_module_module WHERE name=%s AND latest_version=%s", ('base', BASE_VERSION))
# Careful to compare timestamps with 'UTC' - everything is UTC as of v6.1. if cr.fetchone():
cr.execute("""SELECT * FROM ir_cron # Careful to compare timestamps with 'UTC' - everything is UTC as of v6.1.
WHERE numbercall != 0 cr.execute("""SELECT * FROM ir_cron
AND active AND nextcall <= (now() at time zone 'UTC') WHERE numbercall != 0
ORDER BY priority""") AND active AND nextcall <= (now() at time zone 'UTC')
jobs = cr.dictfetchall() ORDER BY priority""")
else: jobs = cr.dictfetchall()
_logger.warning('Skipping database %s as its base version is not %s.', db_name, BASE_VERSION) else:
_logger.warning('Skipping database %s as its base version is not %s.', db_name, BASE_VERSION)
except psycopg2.ProgrammingError, e: except psycopg2.ProgrammingError, e:
if e.pgcode == '42P01': if e.pgcode == '42P01':
# Class 42 — Syntax Error or Access Rule Violation; 42P01: undefined_table # Class 42 — Syntax Error or Access Rule Violation; 42P01: undefined_table
@@ -221,8 +221,6 @@ class ir_cron(osv.osv):
raise raise
except Exception: except Exception:
_logger.warning('Exception in cron:', exc_info=True) _logger.warning('Exception in cron:', exc_info=True)
finally:
cr.close()
for job in jobs: for job in jobs:
lock_cr = db.cursor() lock_cr = db.cursor()
+6 -2
View File
@@ -217,8 +217,12 @@ class ThreadedServer(CommonServer):
_logger.debug('cron%d polling for jobs', number) _logger.debug('cron%d polling for jobs', number)
for db_name, registry in registries.iteritems(): for db_name, registry in registries.iteritems():
while registry.ready: while registry.ready:
acquired = openerp.addons.base.ir.ir_cron.ir_cron._acquire_job(db_name) try:
if not acquired: acquired = openerp.addons.base.ir.ir_cron.ir_cron._acquire_job(db_name)
if not acquired:
break
except Exception:
_logger.warning('cron%d encountered an Exception:', number, exc_info=True)
break break
def cron_spawn(self): def cron_spawn(self):