From bff042d65238ec288da4b854dce8adde418c399c Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Mon, 30 Mar 2015 22:05:15 +0200 Subject: [PATCH] [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 --- addons/mail/mail_thread.py | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index b8c19168227..320e63858ec 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -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 _("""

- Click here to add new %(document)s or send an email to: %(email)s -

- %(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 _("

Click here to add new %(document)s

%(static_help)s") % { - 'document': document_name, - 'static_help': help or '', + if alias: + email_link = "%(email)s" % {'email': alias.name_get()[0][1]} + if add_arrow: + return _("""

+ Click here to add new %(document)s or send an email to: %(email)s. +

+ %(static_help)s""" + ) % { + 'document': document_name, 'email': email_link, 'static_help': help or '' + } + + return _("""%(static_help)s +

+ You could also add a new %(document)s by sending an email to: %(email)s. +

""") % { + 'document': document_name, 'email': email_link, 'static_help': help or '' + } + + if add_arrow: + return _("

Click here to add new %(document)s

%(static_help)s") % { + 'document': document_name, 'static_help': help or '' } return help