Add injection date to file upload results
This commit is contained in:
parent
b657500bf0
commit
f66935698c
|
@ -253,3 +253,7 @@ msgstr "Cancelar"
|
|||
msgctxt "wizard_button:lims.notebook.load_results_file,warning,close:"
|
||||
msgid "Ok"
|
||||
msgstr "Aceptar"
|
||||
|
||||
msgctxt "field:lims.notebook.line,imported_inj_date:"
|
||||
msgid "Injection date"
|
||||
msgstr "Fecha de Inyección"
|
|
@ -35,6 +35,7 @@ class NotebookLine:
|
|||
imported_device = fields.Many2One('lims.lab.device', 'Device')
|
||||
imported_dilution_factor = fields.Float('Dilution factor')
|
||||
imported_rm_correction_formula = fields.Char('RM Correction Formula')
|
||||
imported_inj_date = fields.Date('Inject date')
|
||||
|
||||
|
||||
class ResultsImport(ModelSQL, ModelView):
|
||||
|
@ -267,6 +268,8 @@ class NotebookLoadResultsFile(Wizard):
|
|||
res['imported_literal_result'] = data['literal_result']
|
||||
res['imported_end_date'] = (data['end_date'] if 'end_date' in data
|
||||
else line.end_date)
|
||||
res['imported_inj_date'] = (data['injection_date']
|
||||
if 'injection_date' in data else None)
|
||||
if 'professionals' in data:
|
||||
res['imported_professionals'] = data['professionals']
|
||||
if 'chromatogram' in data:
|
||||
|
@ -359,6 +362,7 @@ class NotebookLoadResultsFile(Wizard):
|
|||
'imported_device': None,
|
||||
'imported_dilution_factor': None,
|
||||
'imported_rm_correction_formula': None,
|
||||
'imported_inj_date': None,
|
||||
}
|
||||
|
||||
prevent_line = False
|
||||
|
@ -386,6 +390,18 @@ class NotebookLoadResultsFile(Wizard):
|
|||
outcome = 'End date cannot be lower than Start date'
|
||||
else:
|
||||
notebook_line_write['end_date'] = None
|
||||
if line.injection_date != line.imported_inj_date:
|
||||
if line.imported_result != '-1000.0':
|
||||
if (line.start_date and
|
||||
line.start_date <= line.imported_inj_date):
|
||||
notebook_line_write['injection_date'] = (
|
||||
line.imported_inj_date)
|
||||
else:
|
||||
prevent_line = True
|
||||
outcome = \
|
||||
'Injection date cannot be lower than Start date'
|
||||
else:
|
||||
notebook_line_write['injection_date'] = None
|
||||
if line.chromatogram != line.imported_chromatogram:
|
||||
notebook_line_write['chromatogram'] = (
|
||||
line.imported_chromatogram)
|
||||
|
@ -438,6 +454,7 @@ class NotebookLoadResultsFile(Wizard):
|
|||
'device': line.device,
|
||||
'dilution_factor': line.dilution_factor,
|
||||
'rm_correction_formula': line.rm_correction_formula,
|
||||
'injection_date': line.injection_date,
|
||||
}
|
||||
NotebookLine.write(
|
||||
[line], notebook_line_original_values)
|
||||
|
@ -482,6 +499,7 @@ class NotebookLoadResultsFile(Wizard):
|
|||
'imported_device': None,
|
||||
'imported_dilution_factor': None,
|
||||
'imported_rm_correction_formula': None,
|
||||
'imported_inj_date': None,
|
||||
}
|
||||
NotebookLine.write(
|
||||
list(self.result.result_lines), notebook_line_clean)
|
||||
|
|
|
@ -12,4 +12,5 @@
|
|||
<field name="imported_chromatogram"/>
|
||||
<field name="imported_rm_correction_formula"/>
|
||||
<field name="imported_literal_result"/>
|
||||
<field name="imported_inj_date"/>
|
||||
</tree>
|
||||
|
|
|
@ -101,8 +101,18 @@ def parse(self, infile):
|
|||
device = str(int(row[COL['C']].value))
|
||||
elif row[COL['C']].ctype == xlrd.XL_CELL_TEXT:
|
||||
device = row[COL['C']].value
|
||||
rm_correction_formula = row[COL['L']].value if (
|
||||
row[COL['L']].ctype == xlrd.XL_CELL_TEXT) else None
|
||||
inj_date_raw = row[COL['L']].value
|
||||
if row[COL['L']].ctype == xlrd.XL_CELL_TEXT:
|
||||
try:
|
||||
it = inj_date_raw.split('/')
|
||||
inj_date = date(int(it[2]), int(it[1]), int(it[0]))
|
||||
except:
|
||||
inj_date = None
|
||||
elif row[COL['L']].ctype == xlrd.XL_CELL_DATE:
|
||||
it = xlrd.xldate_as_tuple(inj_date_raw, workbook.datemode)
|
||||
inj_date = date(it[0], it[1], it[2])
|
||||
else:
|
||||
inj_date = None
|
||||
|
||||
if result is not None:
|
||||
values['result'] = result
|
||||
|
@ -111,14 +121,14 @@ def parse(self, infile):
|
|||
worksheet.number, curr_row, STATUS_COLUMN]
|
||||
if end_date:
|
||||
values['end_date'] = end_date
|
||||
if inj_date:
|
||||
values['injection_date'] = inj_date
|
||||
if professionals:
|
||||
values['professionals'] = professionals
|
||||
if chromatogram:
|
||||
values['chromatogram'] = chromatogram
|
||||
if device:
|
||||
values['device'] = device
|
||||
if rm_correction_formula:
|
||||
values['rm_correction_formula'] = rm_correction_formula
|
||||
values['row_number'] = curr_row + 1
|
||||
|
||||
if fraction in self.rawresults:
|
||||
|
|
|
@ -51,6 +51,21 @@ def parse(self, infile):
|
|||
chromatogram = row2nd[COL['G']].value if (
|
||||
row2nd[COL['G']].ctype == xlrd.XL_CELL_TEXT) else None
|
||||
|
||||
# 3rd row: injection date
|
||||
row3nd = worksheet.row(2)
|
||||
inj_date_raw = row3nd[COL['E']].value
|
||||
if row3nd[COL['E']].ctype == xlrd.XL_CELL_TEXT:
|
||||
try:
|
||||
it = inj_date_raw.split('/')
|
||||
inj_date = date(int(it[2]), int(it[1]), int(it[0]))
|
||||
except:
|
||||
inj_date = None
|
||||
elif row3nd[COL['E']].ctype == xlrd.XL_CELL_DATE:
|
||||
it = xlrd.xldate_as_tuple(inj_date_raw, workbook.datemode)
|
||||
inj_date = date(it[0], it[1], it[2])
|
||||
else:
|
||||
inj_date = None
|
||||
|
||||
# 4th row: sample, year, fraction, repetition,
|
||||
# professional and dilution factor
|
||||
row4th = worksheet.row(3)
|
||||
|
@ -125,6 +140,8 @@ def parse(self, infile):
|
|||
values['device'] = device
|
||||
if end_date:
|
||||
values['end_date'] = end_date
|
||||
if inj_date:
|
||||
values['injection_date'] = inj_date
|
||||
if professionals:
|
||||
values['professionals'] = professionals
|
||||
if chromatogram:
|
||||
|
|
Loading…
Reference in New Issue