[FIX] ir.actions.server: only try to browse the object of a server action (pointed-to by active_id + active_model) only if active_model matches the action's model

bzr revid: xmo@openerp.com-20110912144411-bzh99xqr7c1ucu1a
This commit is contained in:
Xavier Morel 2011-09-12 16:44:11 +02:00
parent 1605fb8f50
commit f03892c5db
1 changed files with 4 additions and 2 deletions

View File

@ -601,8 +601,10 @@ class actions_server(osv.osv):
context = {}
user = self.pool.get('res.users').browse(cr, uid, uid)
for action in self.browse(cr, uid, ids, context):
obj_pool = self.pool.get(action.model_id.model)
obj = obj_pool.browse(cr, uid, context['active_id'], context=context)
obj = None
if context.get('active_model') == action.model_id.model and context.get('active_id'):
obj_pool = self.pool.get(action.model_id.model)
obj = obj_pool.browse(cr, uid, context['active_id'], context=context)
cxt = {
'context': dict(context), # copy context to prevent side-effects of eval
'object': obj,