Skip to content
Snippets Groups Projects
Commit 45bb6f6e authored by Kevin Baptiste's avatar Kevin Baptiste
Browse files

[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: default avatarYannick Tivisse (yti) <yti@odoo.com>
parent 484027f6
Branches
Tags
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment