From b5af64f6d3436ee8b9f2ecb709b4a662049f52e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 23 Sep 2021 10:10:51 +0200 Subject: [PATCH] Do not set record name on title of report get_email issue10724 review362511002 --- CHANGELOG | 1 + trytond/report/report.py | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index ec462c85c6..d8dab1156f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Do not set record name on title of report get_email * Add node to id of status * Use ImmutableDict for Transaction context * Use UNION for 'Or'-ed domain with subqueries diff --git a/trytond/report/report.py b/trytond/report/report.py index 194cc6535a..a20dc89964 100644 --- a/trytond/report/report.py +++ b/trytond/report/report.py @@ -140,11 +140,12 @@ class Report(URLMixin, PoolBase): report type, data, a boolean to direct print, - the report name + the report name (with or without the record names) ''' pool = Pool() ActionReport = pool.get('ir.action.report') cls.check_access() + context = Transaction().context action_id = data.get('action_id') if action_id is None: @@ -212,8 +213,11 @@ class Report(URLMixin, PoolBase): groups[0], headers[0], data, action_report) if not isinstance(content, str): content = bytearray(content) if bytes == str else bytes(content) - filename = '-'.join( - filter(None, [action_report.name, report_name(records)])) + if context.get('with_rec_name', True): + filename = '-'.join( + filter(None, [action_report.name, report_name(records)])) + else: + filename = action_report.name return (oext, content, action_report.direct_print, filename) @classmethod @@ -478,7 +482,8 @@ def get_email(report, record, languages): msg = MIMEMultipart('alternative') msg.add_header('Content-Language', ', '.join(l.code for l in languages)) for language in languages: - with Transaction().set_context(language=language.code): + with Transaction().set_context( + language=language.code, with_rec_name=False): ext, content, _, title = Report_.execute( [record.id], { 'action_id': report_id,