[FIX] base_action_rule: upon update/create of an automated action in multiprocess...
authorOlivier Dony <odo@openerp.com>
Mon, 16 Dec 2013 14:20:49 +0000 (15:20 +0100)
committerOlivier Dony <odo@openerp.com>
Mon, 16 Dec 2013 14:20:49 +0000 (15:20 +0100)
Short of signaling the other workers, the (new) automated
rule may be randomly ignored, depending on which worker
handles the request (until the workers all reload
their registries).

bzr revid: odo@openerp.com-20131216142049-xh9gxy5cir3p2i09

addons/base_action_rule/base_action_rule.py

index a73933f..3d45407 100644 (file)
@@ -23,6 +23,7 @@ from datetime import datetime, timedelta
 import time
 import logging
 
+import openerp
 from openerp import SUPERUSER_ID
 from openerp.osv import fields, osv
 from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
@@ -206,6 +207,7 @@ class base_action_rule(osv.osv):
     def create(self, cr, uid, vals, context=None):
         res_id = super(base_action_rule, self).create(cr, uid, vals, context=context)
         self._register_hook(cr, [res_id])
+        openerp.modules.registry.RegistryManager.signal_registry_change(cr.dbname)
         return res_id
 
     def write(self, cr, uid, ids, vals, context=None):
@@ -213,6 +215,7 @@ class base_action_rule(osv.osv):
             ids = [ids]
         super(base_action_rule, self).write(cr, uid, ids, vals, context=context)
         self._register_hook(cr, ids)
+        openerp.modules.registry.RegistryManager.signal_registry_change(cr.dbname)
         return True
 
     def onchange_model_id(self, cr, uid, ids, model_id, context=None):