[FIX] *: alias help message

When going to logged calls through opportunities,
and no logged calls were listed,
the mail alias of opportunities was displayed
within the placeholder help message,
wrongly, as we were in the logged calls list.

This was due to a context propagation, due
to have defined empty_list_help_* keys within
window actions. It was the case in several
modules.

Besides, we do not find the usefulness of the
custom_context passed to the get_empty_list_help
method: indeed, none of the methods get_empty_list_help
overriden in modules need any other keys than
'default_type', which do not require an evaluated
context.

We therefore remove the whole code regarding this
custom_context, and we therefore get rid of this
useless context evaluation thing within one of
the most accessed method of the web client.

opw-630673
This commit is contained in:
Denis Ledoux 2015-04-01 10:52:37 +02:00
parent dab37df04d
commit 90f998da0b
4 changed files with 4 additions and 17 deletions

View File

@ -12,7 +12,6 @@
<field name="context">{
'default_type':'lead',
'stage_type':'lead',
'empty_list_help_model': 'crm.case.section',
'needaction_menu_ref': 'crm.menu_crm_opportunities',
'search_default_unassigned':1,
}

View File

@ -8,7 +8,7 @@
<field name="view_mode">kanban,tree,form,graph,calendar</field>
<field name="view_id" eval="False"/>
<field name="search_view_id" ref="view_crm_case_jobs_filter"/>
<field name="context">{'empty_list_help_model': 'hr.job'}</field>
<field name="context">{}</field>
<field name="help" type="html">
<p>
Odoo helps you track applicants in the recruitment

View File

@ -311,7 +311,7 @@
<field name="name">Applications</field>
<field name="res_model">hr.applicant</field>
<field name="view_mode">kanban,tree,form,graph,calendar</field>
<field name="context">{'search_default_job_id': [active_id], 'default_job_id': active_id, 'empty_list_help_model': 'hr.job'}</field>
<field name="context">{'search_default_job_id': [active_id], 'default_job_id': active_id}</field>
<field name="help" type="html">
<p>
Odoo helps you track applicants in the recruitment

View File

@ -325,23 +325,11 @@ class ir_actions_act_window(osv.osv):
results = super(ir_actions_act_window, self).read(cr, uid, ids, fields=fields, context=context, load=load)
if not fields or 'help' in fields:
context = dict(context or {})
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:
model = res.get('res_model')
if model and self.pool.get(model):
try:
with tools.mute_logger("openerp.tools.safe_eval"):
eval_context = eval(res['context'] or "{}", eval_dict) or {}
except Exception:
continue
custom_context = dict(context, **eval_context)
res['help'] = self.pool[model].get_empty_list_help(cr, uid, res.get('help', ""), context=custom_context)
ctx = dict(context or {})
res['help'] = self.pool[model].get_empty_list_help(cr, uid, res.get('help', ""), context=ctx)
if ids_int:
return results[0]
return results