[FIX] ir.actions: active_model may not always match current model, in which case `object` should be `None`

bzr revid: odo@openerp.com-20140211082546-tgenye70etn21ih5
This commit is contained in:
Olivier Dony 2014-02-11 09:25:46 +01:00
parent 08fc70a221
commit 722163893e
1 changed files with 3 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
@ -979,6 +979,7 @@ class actions_server(osv.osv):
model = self.pool[action.model_id.model]
active_id = context.get('active_id')
active_ids = context.get('active_ids', [active_id] if active_id else [])
target_record = None
if context.get('active_model') == action.model_id.model and active_id:
context = dict(context, active_ids=active_ids, active_id=active_id)
target_record = model.browse(cr, uid, active_id, context=context) if active_id else None
@ -997,7 +998,7 @@ class actions_server(osv.osv):
'context': context,
}
return eval_context
def run(self, cr, uid, ids, context=None):
""" Run the server action. For each server action, the condition is