From 1c021a5ba65d0ba4e28825cc3e796b1e0319b15b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Bernardi?= Date: Fri, 21 Oct 2022 17:54:30 -0300 Subject: [PATCH] lims_report_html: add suport for fast sample creation --- lims_report_html/sample.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lims_report_html/sample.py b/lims_report_html/sample.py index 93bd346..74016c5 100644 --- a/lims_report_html/sample.py +++ b/lims_report_html/sample.py @@ -49,6 +49,17 @@ class Sample(metaclass=PoolMeta): self.resultrange_origin = ( self.result_template.resultrange_origin.id) + def _get_dict_for_fast_copy(self): + def _many2one(value): + if value: + return str(value.id) + return "NULL" + + res = super()._get_dict_for_fast_copy() + res['result_template'] = _many2one(self.result_template) + res['resultrange_origin'] = _many2one(self.resultrange_origin) + return res + class CreateSampleStart(metaclass=PoolMeta): __name__ = 'lims.create_sample.start'