修复质检的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('已检')
|
||||
@@ -88,6 +88,33 @@
|
||||
<button name="do_cancel_publish" string="取消发布" type="object" class="btn-primary" confirm="确定取消发布吗?" attrs="{'invisible': ['|',('is_out_check', '=', False), ('publish_status', '!=', 'published')]}"/>
|
||||
<button name="do_re_publish" string="重新发布" type="object" class="btn-primary" attrs="{'invisible': ['|', ('is_out_check', '=', False), ('publish_status', '!=', 'canceled')]}"/>
|
||||
</xpath>
|
||||
<xpath expr="//label[@for='qty_line']" position="attributes">
|
||||
<attribute name="attrs">{'invisible': ['&', ('move_line_id', '=', False), ('workorder_id', '=', False)]}</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//div[@class='o_row'][.//field[@name='qty_line']]" position="attributes">
|
||||
<attribute name="attrs">{'invisible': ['&', ('move_line_id', '=', False), ('workorder_id', '=', False)]}</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='qty_line']" position="attributes">
|
||||
<attribute name="readonly">0</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//label[@for='qty_to_test']" position="attributes">
|
||||
<attribute name="attrs">{'invisible': ['|', '&', ('move_line_id', '=', False), ('workorder_id', '=', False), '|', ('measure_on', '!=', 'move_line'), ('is_lot_tested_fractionally', '=', False)]}</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//div[@class='o_row'][.//field[@name='qty_to_test']]" position="attributes">
|
||||
<attribute name="attrs">{'invisible': ['|', '&', ('move_line_id', '=', False), ('workorder_id', '=', False), '|', ('measure_on', '!=', 'move_line'), ('is_lot_tested_fractionally', '=', False)]}</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='qty_to_test']" position="attributes">
|
||||
<attribute name="readonly">0</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//div[@class='o_row'][.//field[@name='qty_tested']]" position="after">
|
||||
<label for="qty_test_failed"
|
||||
attrs="{'invisible': ['|', ('measure_on', '!=', 'move_line'), ('is_lot_tested_fractionally', '=', False)]}"/>
|
||||
<div class="o_row"
|
||||
attrs="{'invisible': ['|', ('measure_on', '!=', 'move_line'), ('is_lot_tested_fractionally', '=', False)]}">
|
||||
<field name="qty_test_failed" attrs="{'readonly': [('quality_state', '!=', 'none')]}"/>
|
||||
<field name="uom_id"/>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user