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

Proposed by Yann Papouin
Status: Merged
Merged at revision: 6801
Proposed branch: lp:~yann-papouin/ocb-addons/6.1-bug-944197-action-rule-register-hook
Merge into: lp:ocb-addons/6.1
Diff against target: 26 lines (+4/-1)
1 file modified
base_action_rule/base_action_rule.py (+4/-1)
To merge this branch: bzr merge lp:~yann-papouin/ocb-addons/6.1-bug-944197-action-rule-register-hook
Reviewer Review Type Date Requested Status
Holger Brunn (Therp) code review Approve
Stefan Rijnhart (Opener) Approve
Review via email: mp+189095@code.launchpad.net

Description of the change

To post a comment you must log in.
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

LGTM, thanks! Note that this part is always safe to merge or update even if you don't update the server on your OpenERP installation. I think we can get the serverside equally independent from the other part.

review: Approve
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Thanks!

review: Approve
Revision history for this message
Holger Brunn (Therp) (hbrunn) :
review: Approve (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'base_action_rule/base_action_rule.py'
2--- base_action_rule/base_action_rule.py 2012-04-26 08:03:00 +0000
3+++ base_action_rule/base_action_rule.py 2013-10-08 13:54:53 +0000
4@@ -20,6 +20,7 @@
5 ##############################################################################
6
7 from osv import fields, osv, orm
8+from openerp import SUPERUSER_ID
9 from tools.translate import _
10 from datetime import datetime
11 from datetime import timedelta
12@@ -202,11 +203,13 @@
13 return True
14 return wrapper
15
16- def _register_hook(self, cr, uid, ids, context=None):
17+ def _register_hook(self, cr, uid=SUPERUSER_ID, ids=None, context=None):
18 """
19 Wrap every `create` and `write` methods of the models specified by
20 the rules (given by `ids`).
21 """
22+ if ids == [] or ids is None:
23+ ids = self.search(cr, uid, [])
24 for action_rule in self.browse(cr, uid, ids, context=context):
25 model = action_rule.model_id.model
26 obj_pool = self.pool.get(model)

Subscribers

People subscribed via source and target branches