[FIX] ir.actions.server: only try to browse the object of a server action (pointed...
authorXavier Morel <xmo@openerp.com>
Mon, 12 Sep 2011 14:44:11 +0000 (16:44 +0200)
committerXavier Morel <xmo@openerp.com>
Mon, 12 Sep 2011 14:44:11 +0000 (16:44 +0200)
bzr revid: xmo@openerp.com-20110912144411-bzh99xqr7c1ucu1a

openerp/addons/base/ir/ir_actions.py

index 67c36b2..fd543a9 100644 (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,