lims, lims_instrument: add field "Trace report" to Notebook lines and

Results reports
This commit is contained in:
Adrián Bernardi 2022-08-09 18:48:52 -03:00
parent 150f583caa
commit dc2a5b406b
13 changed files with 59 additions and 0 deletions

View File

@ -3119,6 +3119,10 @@ msgctxt "field:lims.notebook.line,theoretical_concentration:"
msgid "Theoretical concentration"
msgstr "Concentración teórica"
msgctxt "field:lims.notebook.line,trace_report:"
msgid "Trace report"
msgstr "Traza"
msgctxt "field:lims.notebook.line,uncertainty:"
msgid "Uncertainty"
msgstr "Incertidumbre"
@ -3411,6 +3415,10 @@ msgctxt "field:lims.notebook.line.all_fields,theoretical_concentration:"
msgid "Theoretical concentration"
msgstr "Concentración teórica"
msgctxt "field:lims.notebook.line.all_fields,trace_report:"
msgid "Trace report"
msgstr "Traza"
msgctxt "field:lims.notebook.line.all_fields,uncertainty:"
msgid "Uncertainty"
msgstr "Incertidumbre"
@ -5306,6 +5314,10 @@ msgctxt "field:lims.results_report.version.detail,state:"
msgid "State"
msgstr "Estado"
msgctxt "field:lims.results_report.version.detail,trace_report:"
msgid "Trace report"
msgstr "Informar traza"
msgctxt "field:lims.results_report.version.detail,type:"
msgid "Type"
msgstr "Tipo"
@ -5398,6 +5410,10 @@ msgctxt "field:lims.results_report.version.detail.line,start_date:"
msgid "Start date"
msgstr "Fecha de inicio"
msgctxt "field:lims.results_report.version.detail.line,trace_report:"
msgid "Trace report"
msgstr "Traza"
msgctxt "field:lims.results_report.version.detail.line,uncertainty:"
msgid "Uncertainty"
msgstr "Incertidumbre"

View File

@ -1007,6 +1007,7 @@ class NotebookLine(ModelSQL, ModelView):
readonly=True)
exceptional_load_uid = fields.Many2One('res.user',
'Exceptional loading of results User', readonly=True)
trace_report = fields.Boolean('Trace report')
del _states, _depends
@ -1812,6 +1813,7 @@ class NotebookLineAllFields(ModelSQL, ModelView):
readonly=True)
exceptional_load_uid = fields.Many2One('res.user',
'Exceptional loading of results User', readonly=True)
trace_report = fields.Boolean('Trace report', readonly=True)
@classmethod
def __setup__(cls):
@ -1913,6 +1915,7 @@ class NotebookLineAllFields(ModelSQL, ModelView):
line.repetition_reason,
line.exceptional_load,
line.exceptional_load_uid,
line.trace_report,
]
where = Literal(True)
return join6.select(*columns, where=where)

View File

@ -679,6 +679,7 @@ class ResultsReportVersionDetail(Workflow, ModelSQL, ModelView):
'get_samples_list', searcher='search_samples_list')
entry_summary = fields.Function(fields.Char('Entry / Qty. Samples'),
'get_entry_summary', searcher='search_entry_summary')
trace_report = fields.Boolean('Trace report')
# State changes
revision_uid = fields.Many2One('res.user', 'Revision user', readonly=True)
@ -1563,11 +1564,21 @@ class ResultsReportVersionDetail(Workflow, ModelSQL, ModelView):
@classmethod
def _get_fields_from_samples(cls, samples, generate_report_form=None):
pool = Pool()
Notebook = pool.get('lims.notebook')
detail_default = {}
if len(samples) > 1:
detail_default['report_type_forced'] = 'polisample'
else:
detail_default['report_type_forced'] = 'normal'
detail_default['trace_report'] = False
for sample in samples:
nb = Notebook(sample['notebook'])
if nb.fraction.sample.trace_report:
detail_default['trace_report'] = True
return detail_default
@classmethod
@ -1909,6 +1920,8 @@ class ResultsReportVersionDetailLine(ModelSQL, ModelView):
reference = fields.Function(fields.Char('Reference'), 'get_reference')
comments = fields.Function(fields.Text('Entry comments'),
'get_nline_field')
trace_report = fields.Function(fields.Boolean('Trace report'),
'get_nline_field')
@classmethod
def __register__(cls, module_name):
@ -1965,6 +1978,10 @@ class ResultsReportVersionDetailLine(ModelSQL, ModelView):
result[name][d.id] = field.id if field else None
else:
result[name][d.id] = None
elif cls._fields[name]._type == 'boolean':
for d in details:
result[name][d.id] = (d.notebook_line and
getattr(d.notebook_line, name, False) or False)
else:
for d in details:
result[name][d.id] = (d.notebook_line and

View File

@ -128,4 +128,6 @@
</group>
<label name="exceptional_load_uid"/>
<field name="exceptional_load_uid"/>
<label name="trace_report"/>
<field name="trace_report"/>
</form>

View File

@ -64,4 +64,5 @@
<field name="department"/>
<field name="exceptional_load"/>
<field name="exceptional_load_uid"/>
<field name="trace_report"/>
</tree>

View File

@ -135,4 +135,6 @@
</group>
<label name="exceptional_load_uid"/>
<field name="exceptional_load_uid"/>
<label name="trace_report"/>
<field name="trace_report"/>
</form>

View File

@ -52,4 +52,5 @@
<field name="department"/>
<field name="exceptional_load"/>
<field name="exceptional_load_uid"/>
<field name="trace_report"/>
</tree>

View File

@ -28,6 +28,8 @@
<field name="signer"/>
<label name="resultrange_origin"/>
<field name="resultrange_origin" widget="selection"/>
<label name="trace_report"/>
<field name="trace_report"/>
<notebook>
<page name="samples">
<field name="samples" colspan="4" mode="form,tree"

View File

@ -16,6 +16,7 @@
<field name="converted_result"/>
<field name="final_unit"/>
<field name="comments"/>
<field name="trace_report"/>
<field name="corrected"/>
<field name="hide"/>
</tree>

View File

@ -15,6 +15,7 @@
<field name="signer"/>
<field name="cie_fraction_type"/>
<field name="resultrange_origin"/>
<field name="trace_report"/>
<field name="create_date2" widget="date"/>
<field name="create_date2" widget="time" string="Time"/>
<field name="write_date2" widget="date"/>

View File

@ -38,6 +38,10 @@ msgctxt "field:lims.notebook.line,imported_rm_correction_formula:"
msgid "Imported RM Correction Formula"
msgstr "Fórmula Corrección RM importada"
msgctxt "field:lims.notebook.line,imported_trace_report:"
msgid "Imported Trace report"
msgstr "Traza importada"
msgctxt "field:lims.notebook.load_results_file.export,file:"
msgid "File"
msgstr "Archivo"

View File

@ -30,6 +30,7 @@ class NotebookLine(metaclass=PoolMeta):
imported_rm_correction_formula = fields.Char(
'Imported RM Correction Formula')
imported_inj_date = fields.Date('Imported Inject date')
imported_trace_report = fields.Boolean('Imported Trace report')
class BaseImport(object):
@ -398,6 +399,8 @@ class NotebookLoadResultsFile(Wizard):
if 'rm_correction_formula' in data:
res['imported_rm_correction_formula'] = (
data['rm_correction_formula'])
if 'trace_report' in data:
res['imported_trace_report'] = data['trace_report']
return res
def default_result(self, fields):
@ -532,6 +535,8 @@ class NotebookLoadResultsFile(Wizard):
values.append(line.imported_dilution_factor)
columns.append(sql_table.rm_correction_formula)
values.append(line.imported_rm_correction_formula)
columns.append(sql_table.trace_report)
values.append(line.imported_trace_report)
line_previous_professionals = []
if line.imported_professionals:
@ -594,6 +599,8 @@ class NotebookLoadResultsFile(Wizard):
values.append(Null)
columns.append(sql_table.imported_inj_date)
values.append(Null)
columns.append(sql_table.imported_trace_report)
values.append(Literal(False))
# Write Results to Notebook lines
cursor.execute(*sql_table.update(
columns, values,
@ -623,6 +630,7 @@ class NotebookLoadResultsFile(Wizard):
'imported_dilution_factor': None,
'imported_rm_correction_formula': None,
'imported_inj_date': None,
'imported_trace_report': False,
}
NotebookLine.write(
list(self.result.result_lines), notebook_line_clean)

View File

@ -13,4 +13,5 @@
<field name="imported_rm_correction_formula"/>
<field name="imported_literal_result"/>
<field name="imported_inj_date"/>
<field name="imported_trace_report"/>
</tree>