lims, lims_diagnosis, lims_industry, lims_quality_control: notebook line: new

field to show formated result
This commit is contained in:
Adrián Bernardi 2022-01-17 10:51:03 -03:00
parent 8c360a7fab
commit c99ac07f21
8 changed files with 20 additions and 7 deletions

View File

@ -2789,6 +2789,10 @@ msgctxt "field:lims.notebook.line,final_unit:"
msgid "Final unit"
msgstr "Unidad final"
msgctxt "field:lims.notebook.line,formated_result:"
msgid "Result to report"
msgstr "Resultado a informar"
msgctxt "field:lims.notebook.line,fraction:"
msgid "Fraction"
msgstr "Fracción"
@ -3097,6 +3101,10 @@ msgctxt "field:lims.notebook.line.all_fields,final_unit:"
msgid "Final unit"
msgstr "Unidad final"
msgctxt "field:lims.notebook.all_fields,formated_result:"
msgid "Result to report"
msgstr "Resultado a informar"
msgctxt "field:lims.notebook.line.all_fields,fraction:"
msgid "Fraction"
msgstr "Fracción"

View File

@ -883,6 +883,8 @@ class NotebookLine(ModelSQL, ModelView):
states=_states, depends=_depends)
converted_result = fields.Char('Converted result',
states=_states, depends=_depends)
formated_result = fields.Function(fields.Char('Result to report'),
'get_formated_result')
detection_limit = fields.Char('Detection limit',
states=_states, depends=_depends)
quantification_limit = fields.Char('Quantification limit',
@ -1582,7 +1584,7 @@ class NotebookLine(ModelSQL, ModelView):
return self.planification.comments
return ''
def get_formated_result(self):
def get_formated_result(self, name=None):
res = ''
result_modifier = self.result_modifier
if self.literal_result:
@ -1726,6 +1728,8 @@ class NotebookLineAllFields(ModelSQL, ModelView):
'converted_result_modifier')
result = fields.Char('Result', readonly=True)
converted_result = fields.Char('Converted result', readonly=True)
formated_result = fields.Function(fields.Char('Result to report'),
'get_line_field')
detection_limit = fields.Char('Detection limit', readonly=True)
quantification_limit = fields.Char('Quantification limit', readonly=True)
lower_limit = fields.Char('Lower limit allowed', readonly=True)

View File

@ -1821,7 +1821,7 @@ class ResultsReportVersionDetailLine(ModelSQL, ModelView):
result = {}
for d in details:
result[d.id] = (d.notebook_line and
d.notebook_line.get_formated_result() or None)
d.notebook_line.formated_result or None)
return result
@classmethod

View File

@ -28,6 +28,7 @@
<field name="converted_result_modifier"/>
<field name="result"/>
<field name="converted_result"/>
<field name="formated_result"/>
<field name="detection_limit"/>
<field name="quantification_limit"/>
<field name="lower_limit"/>

View File

@ -24,6 +24,7 @@
<field name="converted_result_modifier"/>
<field name="result"/>
<field name="converted_result"/>
<field name="formated_result"/>
<field name="detection_limit"/>
<field name="quantification_limit"/>
<field name="lower_limit"/>

View File

@ -423,8 +423,7 @@ class SamplesComparatorLine(ModelSQL, ModelView):
result[name] = {}
if name == 'result':
for l in lines:
result[name][l.id] = (
l.notebook_line.get_formated_result())
result[name][l.id] = l.notebook_line.formated_result
elif name == 'converted_result':
for l in lines:
result[name][l.id] = (
@ -462,7 +461,7 @@ class SamplesComparatorLine(ModelSQL, ModelView):
])
if not notebook_line:
return None
return notebook_line[0].get_formated_result()
return notebook_line[0].formated_result
class Cron(metaclass=PoolMeta):

View File

@ -838,7 +838,7 @@ class ResultsReportVersionDetailLine(metaclass=PoolMeta):
])
if not precedent_line:
return ''
return precedent_line[0].get_formated_result()
return precedent_line[0].formated_result
class OpenResultsDetailPrecedent(Wizard):

View File

@ -262,7 +262,7 @@ class NotebookLine(metaclass=PoolMeta):
def get_test_result(cls, lines, name):
result = {}
for line in lines:
result[line.id] = line.get_formated_result()
result[line.id] = line.formated_result
return result
@classmethod