[FIX] mail: translate report name field

When genrating an attachment in a mail message (e.g. the pdf attached
to a confirmation email), the filename was not translated into the
language of the recipient (unlink the email content).

The variable `template` has the contact language in the context while
`self` contains the language of the user executing the action.

Fixes odoo/odoo#66420

closes odoo/odoo#66498

X-original-commit: 6001e7584c28f8d028c782692caa644015c33e9c
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
This commit is contained in:
Martin Trigaux
2021-02-18 16:51:12 +00:00
parent 1f1da0508d
commit 7124d7012d
+1 -1
View File
@@ -191,7 +191,7 @@ class MailTemplate(models.Model):
if template.report_template:
for res_id in template_res_ids:
attachments = []
report_name = self._render_field('report_name', [res_id])[res_id]
report_name = template._render_field('report_name', [res_id])[res_id]
report = template.report_template
report_service = report.report_name