From 01eb15bdfa45bbf4cae85178220c7ab3f192e602 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Fri, 22 Mar 2013 10:37:59 +0100 Subject: [PATCH] [IMP] ir_actions: change var name and add comment bzr revid: chm@openerp.com-20130322093759-cq0uj3c6ucmrpe05 --- openerp/addons/base/ir/ir_actions.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/openerp/addons/base/ir/ir_actions.py b/openerp/addons/base/ir/ir_actions.py index dc8d38df80c..9d2ee186878 100644 --- a/openerp/addons/base/ir/ir_actions.py +++ b/openerp/addons/base/ir/ir_actions.py @@ -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