[FIX] nan_quality_control: recalculate the 'success' field after create lines from template
This commit is contained in:
parent
69f613d1c4
commit
7bbcebf08e
|
@ -210,6 +210,7 @@ def _links_get(self, cr, uid, context={}):
|
|||
res = test_link_proxy.read(cr, uid, ids, ['object', 'name'], context)
|
||||
return [(r['object'], r['name']) for r in res]
|
||||
|
||||
|
||||
class qc_test_link(osv.osv):
|
||||
"""
|
||||
This model is used to manage available models to link in the Reference
|
||||
|
@ -231,7 +232,7 @@ class qc_test_link(osv.osv):
|
|||
qc_test_link()
|
||||
|
||||
|
||||
class qc_test_template_category( osv.osv):
|
||||
class qc_test_template_category(osv.osv):
|
||||
"""
|
||||
This model is used to categorize proof templates.
|
||||
"""
|
||||
|
@ -436,6 +437,7 @@ class qc_test(osv.osv):
|
|||
if not proof[p]:
|
||||
success = False
|
||||
break
|
||||
|
||||
result[test.id] = success
|
||||
return result
|
||||
|
||||
|
@ -565,10 +567,10 @@ class qc_test(osv.osv):
|
|||
template_id, context=context)
|
||||
for test_id in ids:
|
||||
self.write(cr, uid, test_id, {
|
||||
'test_template_id': template_id,
|
||||
'formula': template.formula,
|
||||
'uom_id': template.uom_id and template.uom_id.id
|
||||
}, context)
|
||||
'test_template_id': template_id,
|
||||
'formula': template.formula,
|
||||
'uom_id': template.uom_id and template.uom_id.id
|
||||
}, context)
|
||||
|
||||
test = self.browse(cr, uid, test_id, context)
|
||||
|
||||
|
@ -588,6 +590,11 @@ class qc_test(osv.osv):
|
|||
(6, 0, [x.id for x in line.valid_value_ids]),
|
||||
],
|
||||
}, context)
|
||||
# It writes again the test to force to recalculate 'success' field
|
||||
self.write(cr, uid, test_id, {
|
||||
'formula': template.formula,
|
||||
'uom_id': template.uom_id and template.uom_id.id
|
||||
}, context)
|
||||
return True
|
||||
|
||||
# qc.test
|
||||
|
|
Loading…
Reference in New Issue