[IMP] ir_actions: change var name and add comment
authorChristophe Matthieu <chm@openerp.com>
Fri, 22 Mar 2013 09:37:59 +0000 (10:37 +0100)
committerChristophe Matthieu <chm@openerp.com>
Fri, 22 Mar 2013 09:37:59 +0000 (10:37 +0100)
bzr revid: chm@openerp.com-20130322093759-cq0uj3c6ucmrpe05

openerp/addons/base/ir/ir_actions.py

index dc8d38d..9d2ee18 100644 (file)
@@ -263,30 +263,31 @@ class act_window(osv.osv):
     }
 
     def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
-        u = isinstance(ids, (int, long))
-        if u:
+        """ call the method get_empty_list_help of the model and set the window action help message
+        """
+        ids_int = isinstance(ids, (int, long))
+        if ids_int:
             ids = [ids]
         results = super(act_window, self).read(cr, uid, ids, fields=fields, context=context, load=load)
 
         if not fields or 'help' in fields:
             context = dict(context or {})
-            dic = {
-                'active_model' : context.get('active_model', None),
-                'active_id' : context.get('active_id', None),
-                'active_ids' : context.get('active_ids', None),
+            eval_dict = {
+                'active_model' : context.get('active_model'),
+                'active_id' : context.get('active_id'),
+                'active_ids' : context.get('active_ids'),
                 'uid' : uid,
             }
             for res in results:
-                if res.get('res_model', False):
+                if res.get('res_model'):
                     try:
                         with tools.mute_logger("openerp.tools.safe_eval"):
-                            eval_context = eval(res['context'] or "{}", dic) or {}
+                            eval_context = eval(res['context'] or "{}", eval_dict) or {}
                     except Exception:
                         continue
                     custom_context = dict(context, **eval_context)
                     res['help'] = self.pool.get(res.get('res_model')).get_empty_list_help(cr, uid, res.get('help', ""), context=custom_context)
-        
-        if u:
+        if ids_int:
             return results[0]
         return results