[IMP] ir_actions: change var name and add comment

bzr revid: chm@openerp.com-20130322093759-cq0uj3c6ucmrpe05
This commit is contained in:
Christophe Matthieu
2013-03-22 10:37:59 +01:00
parent 4e74279576
commit 01eb15bdfa
+11 -10
View 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