修复质检的bug
This commit is contained in:
@@ -132,3 +132,27 @@ class QualityCheck(models.Model):
|
||||
return "零件特采发送成功"
|
||||
else:
|
||||
raise ValidationError("零件特采发送失败")
|
||||
|
||||
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
for val in vals_list:
|
||||
if 'point_id' in val and 'measure_on' not in val:
|
||||
# 如果没有控制方式字段,则从检查点读取质量方式
|
||||
point_id = self.env['quality.point'].browse(val['point_id'])
|
||||
val.update({'measure_on': point_id.measure_on})
|
||||
return super(QualityCheck, self).create(vals_list)
|
||||
|
||||
|
||||
@api.depends('move_line_id.qty_done', 'workorder_id.qty_produced')
|
||||
def _compute_qty_line(self):
|
||||
super(QualityCheck, self)._compute_qty_line()
|
||||
for qc in self:
|
||||
if not qc.move_line_id and qc.workorder_id:
|
||||
qc.qty_line = qc.workorder_id.production_id.product_qty
|
||||
|
||||
qty_line = fields.Float(store=True)
|
||||
qty_test_failed = fields.Float('不合格数')
|
||||
qty_to_test = fields.Float('应检', store=True)
|
||||
qty_tested = fields.Float('已检')
|
||||
Reference in New Issue
Block a user