changeset 2ed802287fcb in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset&node=2ed802287fcb
description:
        Do not set record name on title of report get_email

        issue10724
        review362511002
diffstat:

 CHANGELOG                |   1 +
 trytond/report/report.py |  13 +++++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diffs (49 lines):

diff -r bf276f67b2c4 -r 2ed802287fcb CHANGELOG
--- a/CHANGELOG Thu Sep 23 10:04:07 2021 +0200
+++ b/CHANGELOG Thu Sep 23 10:10:51 2021 +0200
@@ -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 -r bf276f67b2c4 -r 2ed802287fcb trytond/report/report.py
--- a/trytond/report/report.py  Thu Sep 23 10:04:07 2021 +0200
+++ b/trytond/report/report.py  Thu Sep 23 10:10:51 2021 +0200
@@ -140,11 +140,12 @@
             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 @@
                 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 @@
     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,

Reply via email to