[IMP] hr_expense: show alias_email on list helper
The "Incoming Emails" setting is now enabled by default and the email address shown on the list helper. closes odoo/odoo#56069 Taskid: 2300864 Related: odoo/enterprise#12494 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
@@ -11,4 +11,7 @@
|
||||
<field name="can_be_expensed" eval="True"/>
|
||||
</record>
|
||||
</data>
|
||||
<data>
|
||||
<function model="ir.config_parameter" name="set_param" eval="('hr_expense.use_mailgateway', True)"/>
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
@@ -268,17 +268,18 @@ class HrExpense(models.Model):
|
||||
|
||||
@api.model
|
||||
def get_empty_list_help(self, help_message):
|
||||
if help_message and "o_view_nocontent_smiling_face" not in help_message:
|
||||
use_mailgateway = self.env['ir.config_parameter'].sudo().get_param('hr_expense.use_mailgateway')
|
||||
alias_record = use_mailgateway and self.env.ref('hr_expense.mail_alias_expense') or False
|
||||
if alias_record and alias_record.alias_domain and alias_record.alias_name:
|
||||
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="o_view_nocontent_smiling_face">%s</p><p class="oe_view_nocontent_alias">%s</p>' % (
|
||||
_('Add a new expense,'),
|
||||
_('or send receipts by email to %s.') % (link),)
|
||||
return super(HrExpense, self).get_empty_list_help(help_message)
|
||||
return super(HrExpense, self).get_empty_list_help(help_message + self._get_empty_list_mail_alias())
|
||||
|
||||
@api.model
|
||||
def _get_empty_list_mail_alias(self):
|
||||
use_mailgateway = self.env['ir.config_parameter'].sudo().get_param('hr_expense.use_mailgateway')
|
||||
alias_record = use_mailgateway and self.env.ref('hr_expense.mail_alias_expense') or False
|
||||
if alias_record and alias_record.alias_domain and alias_record.alias_name:
|
||||
return """
|
||||
<p>
|
||||
Or send your receipts at <a href="mailto:%(email)s?subject=Lunch%%20with%%20customer%%3A%%20%%2412.32">%(email)s</a>.
|
||||
</p>""" % {'email': '%s@%s' % (alias_record.alias_name, alias_record.alias_domain)}
|
||||
return ""
|
||||
|
||||
# ----------------------------------------
|
||||
# Actions
|
||||
|
||||
Reference in New Issue
Block a user