Numérigraphe has proposed merging 
lp:~numerigraphe/openobject-client/trunk-action-context-none into 
lp:openobject-client.

Requested reviews:
  OpenERP sa GTK client R&D (openerp-dev-gtk)
Related bugs:
  Bug #943393 in OpenERP GTK Client: "Action fails when context is explicitly 
None"
  https://bugs.launchpad.net/openobject-client/+bug/943393

For more details, see:
https://code.launchpad.net/~numerigraphe/openobject-client/trunk-action-context-none/+merge/95210

This branch makes sure the default context is immutable in _exec_action() and 
fixes a bug in reading the context from action.
-- 
https://code.launchpad.net/~numerigraphe/openobject-client/trunk-action-context-none/+merge/95210
Your team OpenERP sa GTK client R&D is requested to review the proposed merge 
of lp:~numerigraphe/openobject-client/trunk-action-context-none into 
lp:openobject-client.
=== modified file 'bin/modules/action/main.py'
--- bin/modules/action/main.py	2011-12-09 11:22:31 +0000
+++ bin/modules/action/main.py	2012-02-29 16:53:18 +0000
@@ -86,13 +86,19 @@
         res = rpc.session.rpc_exec_auth('/object', 'execute', type, 'read', act_id, False, ctx)
         self._exec_action(res,datas,context)
 
-    def _exec_action(self, action, datas, context={}):
+    def _exec_action(self, action, datas, context=None):
+        if context is None:
+            context = {}
         if isinstance(action, bool) or 'type' not in action:
             return
         # Updating the context : Adding the context of action in order to use it on Views called from buttons
         if datas.get('id',False):
             context.update( {'active_id': datas.get('id',False), 'active_ids': datas.get('ids',[]), 'active_model': datas.get('model',False)})
-        context.update(tools.expr_eval(action.get('context','{}'), context.copy()))
+        # set a default context even if action.get('context') is explicitly None
+        act_context = action.get('context')
+        if act_context is None:
+            act_context = {}
+        context.update(tools.expr_eval(act_context, context.copy()))
         if action['type'] in ['ir.actions.act_window', 'ir.actions.submenu']:
             for key in ('res_id', 'res_model', 'view_type', 'view_mode',
                     'limit', 'auto_refresh', 'search_view', 'auto_search', 'search_view_id'):

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to