[FIX] *: no concatenation of static and dynamic nocontent helper

* crm, hr_expense, mail

The nocontent helper can be generated either statically (in xml)
or dynamically (in python).

Before this commit, the result of some nocontent helpers was simply
the concatenation of the static and dynamic parts.

Due to recent changes (see https://github.com/odoo/odoo/commit/a87d761fdbf345ada5dc93e0a686b08a0f5a0417),
the nocontent helper has changed so that any of the nocontent helper
parts has to define its style for showing the face (e.g. smiling,
neutral, or folder face).

As a consequence of the changes above, the styles of some
nocontent helper screens were duplicated, e.g. two smiling faces
were shown instead of a single one.

With this commit, most dynamically generated nocontent helpers keep
only the dynamic part, so the static part is usually dropped in this
case.

Exception to above rule:

    dyn_help = 'You could also add a new [document_name] by sending an email to [email_link]'

The dynamic part is appended right after the static help message, in its dedicated paragraph.
This commit is contained in:
Alexandre Kühn
2018-02-22 16:53:52 +01:00
parent 1753017255
commit d56d96dc03
3 changed files with 9 additions and 12 deletions
+1 -1
View File
@@ -910,7 +910,7 @@ class Lead(models.Model):
def get_empty_list_help(self, help):
help_title, sub_title = "", ""
if self._context.get('default_type') == 'lead':
help_title = _('Click here to add new Leads')
help_title = _('Add a new lead')
else:
help_title = _('Create a new opportunity to add it to your pipeline')
alias_record = self.env['mail.alias'].search([
+3 -4
View File
@@ -137,10 +137,9 @@ class HrExpense(models.Model):
link = "<a id='o_mail_test' href='mailto:%(email)s?subject=Lunch%%20with%%20customer%%3A%%20%%2412.32'>%(email)s</a>" % {
'email': '%s@%s' % (alias_record.alias_name, alias_record.alias_domain)
}
return '<p class="oe_view_nocontent_create">%s<br/>%s</p>%s' % (
_('Click to add a new expense,'),
_('or send receipts by email to %s.') % (link,),
help_message)
return '<p class="oe_view_nocontent_smiling_face">%s</p><p>%s</p>' % (
_('Add a new expense,'),
_('or send receipts by email to %s.') % (link),)
return super(HrExpense, self).get_empty_list_help(help_message)
# ----------------------------------------
+5 -7
View File
@@ -331,24 +331,22 @@ class MailThread(models.AbstractModel):
if alias:
email_link = "<a href='mailto:%(email)s'>%(email)s</a>" % {'email': alias.name_get()[0][1]}
if nothing_here:
return "<p class='o_view_nocontent_smiling_face'>%(dyn_help)s</p>%(static_help)s" % {
'static_help': help or '',
'dyn_help': _("Add new %(document)s or send an email to: %(email_link)s") % {
return "<p class='o_view_nocontent_smiling_face'>%(dyn_help)s</p>" % {
'dyn_help': _("Add a new %(document)s or send an email to %(email_link)s") % {
'document': document_name,
'email_link': email_link
}
}
return "%(static_help)s<p>%(dyn_help)s</p>" % {
'static_help': help or '',
'dyn_help': _("You could also add a new %(document)s by sending an email to: %(email_link)s") % {
'static_help': help,
'dyn_help': _("You could also add a new %(document)s by sending an email to %(email_link)s") % {
'document': document_name,
'email_link': email_link,
}
}
if nothing_here:
return "<p class='o_view_nocontent_smiling_face'>%(dyn_help)s</p>%(static_help)s" % {
'static_help': help or '',
return "<p class='o_view_nocontent_smiling_face'>%(dyn_help)s</p>" % {
'dyn_help': _("Create a new %(document)s") % {
'document': document_name,
}