[IMP] base_action_rule: update records before executing server actions

bzr revid: rco@openerp.com-20130301110301-xu4iaxi7hysmclm4
This commit is contained in:
Raphael Collet 2013-03-01 12:03:01 +01:00
parent 51fbcd39fb
commit 9c21a6902a
1 changed files with 9 additions and 9 deletions

View File

@ -108,15 +108,6 @@ class base_action_rule(osv.osv):
def _process(self, cr, uid, action, record_ids, context=None):
""" process the given action on the records """
# execute server actions
model = self.pool.get(action.model_id.model)
if action.server_action_ids:
server_action_ids = map(int, action.server_action_ids)
for record in model.browse(cr, uid, record_ids, context):
action_server_obj = self.pool.get('ir.actions.server')
ctx = dict(context, active_model=model._name, active_ids=[record.id], active_id=record.id)
action_server_obj.run(cr, uid, server_action_ids, context=ctx)
# modify records
values = {}
if 'date_action_last' in model._all_columns:
@ -130,6 +121,15 @@ class base_action_rule(osv.osv):
follower_ids = map(int, action.act_followers)
model.message_subscribe(cr, uid, record_ids, follower_ids, context=context)
# execute server actions
model = self.pool.get(action.model_id.model)
if action.server_action_ids:
server_action_ids = map(int, action.server_action_ids)
for record in model.browse(cr, uid, record_ids, context):
action_server_obj = self.pool.get('ir.actions.server')
ctx = dict(context, active_model=model._name, active_ids=[record.id], active_id=record.id)
action_server_obj.run(cr, uid, server_action_ids, context=ctx)
return True
def _wrap_create(self, old_create, model):