From 257b3974b55059e693b83eafb62f4e5ad8454669 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Tue, 9 Oct 2012 16:42:21 +0530 Subject: [PATCH] [FIX] base_action_rule: argument in _action bzr revid: hmo@tinyerp.com-20121009111221-dris93pcszjj11es --- addons/base_action_rule/base_action_rule.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/addons/base_action_rule/base_action_rule.py b/addons/base_action_rule/base_action_rule.py index d749415f0d055..9440716815c1e 100644 --- a/addons/base_action_rule/base_action_rule.py +++ b/addons/base_action_rule/base_action_rule.py @@ -234,7 +234,7 @@ def _check(self, cr, uid, automatic=False, use_new_cursor=False, \ action_date = base + delay if (not last_run or (last_run <= action_date < now)): try: - self._action(cr, uid, rule, obj, context=ctx) + self._action(cr, uid, [rule.id], obj, context=ctx) self.write(cr, uid, [rule.id], {'last_run': now}, context=context) except Exception, e: import traceback @@ -308,7 +308,7 @@ def do_action(self, cr, uid, action, obj, context=None): model_obj.message_subscribe(cr, uid, [obj.id], new_followers, context=context) return True - def _action(self, cr, uid, action, obj, scrit=None, context=None): + def _action(self, cr, uid, ids, objects, scrit=None, context=None): """ Do Action """ if context is None: context = {} @@ -316,9 +316,12 @@ def _action(self, cr, uid, action, obj, scrit=None, context=None): context.update({'action': True}) if not scrit: scrit = [] - - if self.do_check(cr, uid, action, obj, context=context): - self.do_action(cr, uid, action, obj, context=context) + if not isinstance(objects, list): + objects = [objects] + for action in self.browse(cr, uid, ids, context=context): + for obj in objects: + if self.do_check(cr, uid, action, obj, context=context): + self.do_action(cr, uid, action, obj, context=context) context.update({'action': False}) return True