From fb7516ddb1fd7212cd6c0f7a5672ef475475b82f Mon Sep 17 00:00:00 2001 From: Abraham Cabezas Date: Thu, 24 Sep 2020 09:51:09 +0200 Subject: [PATCH] Add record name in report filename issue9509 review306161002 --- CHANGELOG | 1 + trytond/report/report.py | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 86ff3ccb14..315d0c22c2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Add record name in report filename * Add deletable and writable state from ir.rule to read * Add language attribute to data tag * Add e-mail template diff --git a/trytond/report/report.py b/trytond/report/report.py index 87242a29fd..35e112b263 100644 --- a/trytond/report/report.py +++ b/trytond/report/report.py @@ -174,7 +174,12 @@ class Report(URLMixin, PoolBase): oext, content = cls._execute(records, data, action_report) if not isinstance(content, str): content = bytearray(content) if bytes == str else bytes(content) - return (oext, content, action_report.direct_print, action_report.name) + + suffix = '-'.join(r.rec_name for r in records[:5]) + if len(records) > 5: + suffix += '__' + str(len(records[5:])) + report_name = '%s-%s' % (action_report.name, suffix) + return (oext, content, action_report.direct_print, report_name) @classmethod def _execute(cls, records, data, action):