From f03892c5db2c463a41045f02a2f6df861fd4030f Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 12 Sep 2011 16:44:11 +0200 Subject: [PATCH] [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 --- openerp/addons/base/ir/ir_actions.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openerp/addons/base/ir/ir_actions.py b/openerp/addons/base/ir/ir_actions.py index 67c36b277dd..fd543a98808 100644 --- a/openerp/addons/base/ir/ir_actions.py +++ b/openerp/addons/base/ir/ir_actions.py @@ -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,