← Back to team overview

openerp-community-reviewer team mailing list archive

lp:~yann-papouin/ocb-addons/6.1-bug-944197-action-rule-register-hook into lp:ocb-addons/6.1

 

Yann Papouin has proposed merging lp:~yann-papouin/ocb-addons/6.1-bug-944197-action-rule-register-hook into lp:ocb-addons/6.1.

Requested reviews:
  OpenERP Community Backports Team (ocb)
Related bugs:
  Bug #944197 in OpenERP Community Backports (Addons): "Action Rules don't work right after server is started"
  https://bugs.launchpad.net/ocb-addons/+bug/944197

For more details, see:
https://code.launchpad.net/~yann-papouin/ocb-addons/6.1-bug-944197-action-rule-register-hook/+merge/189095

Automatically derived from https://code.launchpad.net/~yann-papouin/openobject-addons/6.1-bug-944197-action-rule-register-hook for https://code.launchpad.net/~openerp/openobject-addons/6.1. Below is a copy of the original description.

Changes are mainly to stay compatible with openobject-server
-- 
https://code.launchpad.net/~yann-papouin/ocb-addons/6.1-bug-944197-action-rule-register-hook/+merge/189095
Your team OpenERP Community Backports Team is requested to review the proposed merge of lp:~yann-papouin/ocb-addons/6.1-bug-944197-action-rule-register-hook into lp:ocb-addons/6.1.
=== modified file 'base_action_rule/base_action_rule.py'
--- base_action_rule/base_action_rule.py	2012-04-26 08:03:00 +0000
+++ base_action_rule/base_action_rule.py	2013-10-03 14:36:33 +0000
@@ -20,6 +20,7 @@
 ##############################################################################
 
 from osv import fields, osv, orm
+from openerp import SUPERUSER_ID
 from tools.translate import _
 from datetime import datetime
 from datetime import timedelta
@@ -202,11 +203,13 @@
             return True
         return wrapper
 
-    def _register_hook(self, cr, uid, ids, context=None):
+    def _register_hook(self, cr, uid=SUPERUSER_ID, ids=None, context=None):
         """
         Wrap every `create` and `write` methods of the models specified by
         the rules (given by `ids`).
         """
+        if ids is None:
+            ids = self.search(cr, uid, [])
         for action_rule in self.browse(cr, uid, ids, context=context):
             model = action_rule.model_id.model
             obj_pool = self.pool.get(model)


Follow ups