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
(grafted from 96d629fe11a710b395d9981881c5dfda1674becf)

--HG--
branch : 6.0
This commit is contained in:
Cédric Krier committed 2024-04-13 15:00:52 +02:00
1 parent c9183d7e61
commit bffbc47e1c
1 file changed
+4 -10
+4 -10
View File
@@ -665,16 +665,10 @@ class ActionReport(ActionMixin, ModelSQL, ModelView):
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):