[FIX] mail: two arrows in empty list help

When an mail alias for catchall domain was assigned, some checks were not done
and a empty list help was wrongly displayed. Thus two arrays and some inconsistent
messages were displayed.

This commit correct this behavior so only one arrow is displayed.

Another part of the issue, was an erroneous propagation of context which should
be solved by a futur commit.

opw-630673
This commit is contained in:
Nicolas Lempereur 2015-03-30 22:05:15 +02:00
parent b9977ef5d3
commit bff042d652
1 changed files with 22 additions and 15 deletions

View File

@ -129,22 +129,29 @@ class mail_thread(osv.AbstractModel):
if alias_ids and len(alias_ids) == 1:
alias = alias_obj.browse(cr, uid, alias_ids[0], context=context)
if alias:
alias_email = alias.name_get()[0][1]
return _("""<p class='oe_view_nocontent_create'>
Click here to add new %(document)s or send an email to: <a href='mailto:%(email)s'>%(email)s</a>
</p>
%(static_help)s"""
) % {
'document': document_name,
'email': alias_email,
'static_help': help or ''
}
add_arrow = not help or help.find("oe_view_nocontent_create") == -1
if document_name != 'document' and help and help.find("oe_view_nocontent_create") == -1:
return _("<p class='oe_view_nocontent_create'>Click here to add new %(document)s</p>%(static_help)s") % {
'document': document_name,
'static_help': help or '',
if alias:
email_link = "<a href='mailto:%(email)s'>%(email)s</a>" % {'email': alias.name_get()[0][1]}
if add_arrow:
return _("""<p class='oe_view_nocontent_create'>
Click here to add new %(document)s or send an email to: %(email)s.
</p>
%(static_help)s"""
) % {
'document': document_name, 'email': email_link, 'static_help': help or ''
}
return _("""%(static_help)s
<p>
You could also add a new %(document)s by sending an email to: %(email)s.
</p>""") % {
'document': document_name, 'email': email_link, 'static_help': help or ''
}
if add_arrow:
return _("<p class='oe_view_nocontent_create'>Click here to add new %(document)s</p>%(static_help)s") % {
'document': document_name, 'static_help': help or ''
}
return help