changeset 8579d80129c8 in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset;node=8579d80129c8
description:
Add record name in report filename
issue9509
review306161002
diffstat:
CHANGELOG | 1 +
trytond/report/report.py | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletions(-)
diffs (25 lines):
diff -r 1ea664070b7a -r 8579d80129c8 CHANGELOG
--- a/CHANGELOG Wed Sep 23 10:06:49 2020 +0200
+++ b/CHANGELOG Thu Sep 24 09:51:09 2020 +0200
@@ -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 -r 1ea664070b7a -r 8579d80129c8 trytond/report/report.py
--- a/trytond/report/report.py Wed Sep 23 10:06:49 2020 +0200
+++ b/trytond/report/report.py Thu Sep 24 09:51:09 2020 +0200
@@ -174,7 +174,12 @@
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):