From b2ccdd1d9c3c0b4d52acbcedb4837bcdd2ad3c09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 13 Apr 2024 15:00:52 +0200 Subject: [PATCH] Use function to not copy custom report content The Function fields are not copied so it is the storage field that must have a default value. Closes #13170 --- trytond/trytond/ir/action.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/trytond/trytond/ir/action.py b/trytond/trytond/ir/action.py index de82dc49c6..f86cc9521f 100644 --- a/trytond/trytond/ir/action.py +++ b/trytond/trytond/ir/action.py @@ -685,16 +685,10 @@ class ActionReport( default = {} default = default.copy() default.setdefault('module', None) - - new_reports = [] - for report in reports: - if report.report: - default['report_content'] = None - default['report'] = None - default['report_name'] = report.report_name - new_reports.extend(super(ActionReport, cls).copy([report], - default=default)) - return new_reports + default.setdefault( + 'report_content_custom', + lambda o: None if o['report'] else o['report_content_custom']) + return super().copy(reports, default=default) @classmethod def write(cls, reports, values, *args):