lims_analysis_sheet: add support for . expressions in default values (2)

This commit is contained in:
Sebastián Marró 2020-05-12 16:55:25 -03:00
parent 0f1e2718c6
commit 279567c6be
2 changed files with 5 additions and 5 deletions

View File

@ -598,7 +598,7 @@ class AnalysisSheet(Workflow, ModelSQL, ModelView):
for k in list(schema.keys()):
if schema[k]['is_fixed_value']:
value = schema[k]['fixed_value']
if '.' in value:
if value.startswith('='):
continue
if schema[k]['type'] == 'boolean':
fixed_values[k] = bool(value)
@ -619,9 +619,9 @@ class AnalysisSheet(Workflow, ModelSQL, ModelView):
line.update(fixed_values)
for k in list(schema.keys()):
if (schema[k]['is_fixed_value'] and '.' in schema[k][
'fixed_value']):
path = schema[k]['fixed_value'].split('.')
if (schema[k]['is_fixed_value'] and schema[k][
'fixed_value']).startswith('='):
path = schema[k]['fixed_value'][1:].split('.')
field = path.pop(0)
try:
value = getattr(nl, field)

View File

@ -121,7 +121,7 @@ def str2date(value, lang=None):
def get_model_resource(model_name, value, field_name):
if '.' in value:
if value.startswith('='):
return None
Model = Pool().get(model_name)
rec_name = Model._rec_name