lims_report_html: do not delete current sections when changing template

This commit is contained in:
Adrián Bernardi 2021-07-26 12:39:34 -03:00
parent e50be7e2e2
commit 9d810d76d7
1 changed files with 10 additions and 7 deletions

View File

@ -98,13 +98,16 @@ class ResultsReportVersionDetail(metaclass=PoolMeta):
} for c in self.template.trend_charts]
self.charts_x_row = self.template.charts_x_row
if self.template and self.template.sections:
self.sections = [{
'name': s.name,
'data': s.data,
'data_id': s.data_id,
'position': s.position,
'order': s.order,
} for s in self.template.sections]
sections = {}
for s in self.sections + self.template.sections:
sections[s.name] = {
'name': s.name,
'data': s.data,
'data_id': s.data_id,
'position': s.position,
'order': s.order,
}
self.sections = sections.values()
def get_previous_sections(self, name):
return [s.id for s in self.sections if s.position == 'previous']