修改cnc获取在制造订单的逻辑,制造订单所有工单完成时 制造订单自动完成,以及组件自动消耗掉

This commit is contained in:
qihao.gong@jikimo.com
2024-01-03 17:29:37 +08:00
parent 77db3d57c9
commit 583f6503ec
4 changed files with 74 additions and 10 deletions

View File

@@ -447,7 +447,7 @@ class ResMrpWorkOrder(models.Model):
'embryo_height': cnc.product_id.bom_ids.bom_line_ids.product_id.height,
'embryo_width': cnc.product_id.bom_ids.bom_line_ids.product_id.width,
'order_no': cnc.production_id.origin,
'model_order_no': cnc.product_id.default_code.rsplit('-', 1)[0],
'model_order_no': cnc.product_id.default_code.rsplit(' -', 1)[0],
'user': self.env.user.name,
'model_file': '' if not cnc.product_id.model_file else base64.b64encode(
cnc.product_id.model_file).decode('utf-8')
@@ -571,6 +571,18 @@ class ResMrpWorkOrder(models.Model):
'order_line': order_line_ids,
})
super().button_finish()
is_production_id = True
for workorder in self.production_id.workorder_ids:
if workorder.state != 'done':
is_production_id = False
if is_production_id == True and self.name == '解除装夹':
for move_raw_id in self.production_id.move_raw_ids:
move_raw_id.quantity_done = move_raw_id.product_uom_qty
self.production_id.state = 'done'
class CNCprocessing(models.Model):
@@ -592,6 +604,7 @@ class CNCprocessing(models.Model):
estimated_processing_time = fields.Char('预计加工时间')
remark = fields.Text('备注')
workorder_id = fields.Many2one('mrp.workorder', string="工单")
workorder_id = fields.Many2one('mrp.production', string="制造定单")
button_state = fields.Boolean(string='是否已经下发')
# mrs下发编程单创建CNC加工