[FIX] needaction on mail.groups
authorFabien Pinckaers <fp@tinyerp.com>
Thu, 23 Aug 2012 14:35:25 +0000 (16:35 +0200)
committerFabien Pinckaers <fp@tinyerp.com>
Thu, 23 Aug 2012 14:35:25 +0000 (16:35 +0200)
bzr revid: fp@tinyerp.com-20120823143525-28mnbgd015jd8yyd

openerp/addons/base/ir/ir_actions.py
openerp/addons/base/ir/ir_ui_menu.py

index cf67e6f..6f906f5 100644 (file)
@@ -879,6 +879,8 @@ class act_client(osv.osv):
                                 "is no central tag repository across clients."),
         'res_model': fields.char('Destination Model', size=64, 
             help="Optional model, mostly used for needactions."),
+        'context': fields.char('Context Value', size=250, required=True,
+            help="Context dictionary as Python expression, empty by default (Default: {})"),
         'params': fields.function(_get_params, fnct_inv=_set_params,
                                   type='binary', 
                                   string="Supplementary arguments",
@@ -888,6 +890,7 @@ class act_client(osv.osv):
     }
     _defaults = {
         'type': 'ir.actions.client',
+        'context': '{}',
 
     }
 act_client()
index eefa8ea..05523fa 100644 (file)
@@ -269,8 +269,13 @@ class ir_ui_menu(osv.osv):
             if menu.action and menu.action.type in ('ir.actions.act_window','ir.actions.client') and menu.action.res_model:
                 obj = self.pool.get(menu.action.res_model)
                 if obj._needaction:
+                    dom = []
+                    if menu.action.type=='ir.actions.act_window':
+                        dom = menu.action.domain and eval(menu.action.domain, {'uid': uid}) or []
+                    else:
+                        dom = eval(menu.action.params_store or '{}', {'uid': uid}).get('domain')
                     res[menu.id]['needaction_enabled'] = obj._needaction
-                    res[menu.id]['needaction_counter'] = obj._needaction_count(cr, uid, menu.action.domain and eval(menu.action.domain), context=context)
+                    res[menu.id]['needaction_counter'] = obj._needaction_count(cr, uid, dom, context=context)
         return res
 
     _columns = {