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

Proposed by Yann Papouin
Status: Needs review
Proposed branch: lp:~yann-papouin/openobject-addons/6.1-bug-944197-action-rule-register-hook
Merge into: lp:openobject-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/openobject-addons/6.1-bug-944197-action-rule-register-hook
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+189089@code.launchpad.net

Description of the change

Changes are mainly to stay compatible with openobject-server

To post a comment you must log in.
7255. By Yann Papouin

Fix due to changes that allow to update the server without breaking the addons part.

Unmerged revisions

7255. By Yann Papouin

Fix due to changes that allow to update the server without breaking the addons part.

7254. By Yann Papouin

[FIX] Action Rules don't work right after server is started (note: server repo must be patched too)

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:51:17 +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)