[FIX] nan_quality_control: recalculate the 'success' field after create lines from template
This commit is contained in:
parent
69f613d1c4
commit
7bbcebf08e
|
@ -202,7 +202,7 @@ qc_proof_synonym()
|
||||||
|
|
||||||
def _links_get(self, cr, uid, context={}):
|
def _links_get(self, cr, uid, context={}):
|
||||||
"""
|
"""
|
||||||
Returns a list of tuples of 'model names' and 'Model title' to use as
|
Returns a list of tuples of 'model names' and 'Model title' to use as
|
||||||
typs in reference fields.
|
typs in reference fields.
|
||||||
"""
|
"""
|
||||||
test_link_proxy = self.pool.get('qc.test.link')
|
test_link_proxy = self.pool.get('qc.test.link')
|
||||||
|
@ -210,28 +210,29 @@ def _links_get(self, cr, uid, context={}):
|
||||||
res = test_link_proxy.read(cr, uid, ids, ['object', 'name'], context)
|
res = test_link_proxy.read(cr, uid, ids, ['object', 'name'], context)
|
||||||
return [(r['object'], r['name']) for r in res]
|
return [(r['object'], r['name']) for r in res]
|
||||||
|
|
||||||
|
|
||||||
class qc_test_link(osv.osv):
|
class qc_test_link(osv.osv):
|
||||||
"""
|
"""
|
||||||
This model is used to manage available models to link in the Reference
|
This model is used to manage available models to link in the Reference
|
||||||
fields of qc.test and qc.test.template
|
fields of qc.test and qc.test.template
|
||||||
"""
|
"""
|
||||||
_name = 'qc.test.link'
|
_name = 'qc.test.link'
|
||||||
_description = "Test Reference Types"
|
_description = "Test Reference Types"
|
||||||
_order = 'priority'
|
_order = 'priority'
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'name': fields.char('Name', size=64, required=True, translate=True),
|
'name': fields.char('Name', size=64, required=True, translate=True),
|
||||||
'object': fields.char('Object', size=64, required=True),
|
'object': fields.char('Object', size=64, required=True),
|
||||||
'priority': fields.integer('Priority'),
|
'priority': fields.integer('Priority'),
|
||||||
}
|
}
|
||||||
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'priority': 5,
|
'priority': 5,
|
||||||
}
|
}
|
||||||
qc_test_link()
|
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.
|
This model is used to categorize proof templates.
|
||||||
"""
|
"""
|
||||||
|
@ -436,6 +437,7 @@ class qc_test(osv.osv):
|
||||||
if not proof[p]:
|
if not proof[p]:
|
||||||
success = False
|
success = False
|
||||||
break
|
break
|
||||||
|
|
||||||
result[test.id] = success
|
result[test.id] = success
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -565,10 +567,10 @@ class qc_test(osv.osv):
|
||||||
template_id, context=context)
|
template_id, context=context)
|
||||||
for test_id in ids:
|
for test_id in ids:
|
||||||
self.write(cr, uid, test_id, {
|
self.write(cr, uid, test_id, {
|
||||||
'test_template_id': template_id,
|
'test_template_id': template_id,
|
||||||
'formula': template.formula,
|
'formula': template.formula,
|
||||||
'uom_id': template.uom_id and template.uom_id.id
|
'uom_id': template.uom_id and template.uom_id.id
|
||||||
}, context)
|
}, context)
|
||||||
|
|
||||||
test = self.browse(cr, uid, test_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]),
|
(6, 0, [x.id for x in line.valid_value_ids]),
|
||||||
],
|
],
|
||||||
}, context)
|
}, 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
|
return True
|
||||||
|
|
||||||
# qc.test
|
# qc.test
|
||||||
|
|
Loading…
Reference in New Issue