解决表面工艺外协调拨单验证报错的问题
This commit is contained in:
@@ -1533,7 +1533,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
# workorder.rfid_code_old = rfid_code
|
||||
# workorder.rfid_code = False
|
||||
logging.info('workorder.rfid_code:%s' % workorder.rfid_code)
|
||||
# if is_production_id is True and record.routing_type in ['解除装夹', '表面工艺', '切割']:
|
||||
|
||||
if is_production_id is True:
|
||||
logging.info('product_qty:%s' % record.production_id.product_qty)
|
||||
for move_raw_id in record.production_id.move_raw_ids:
|
||||
@@ -1548,6 +1548,17 @@ class ResMrpWorkOrder(models.Model):
|
||||
# if raw_move:
|
||||
# raw_move.write({'state': 'done'})
|
||||
if record.production_id.state != 'rework':
|
||||
# 如果工单包含了外协工序,需要预留数量
|
||||
if self.move_raw_ids.move_orig_ids.subcontract_workorder_id:
|
||||
location_id = self.move_raw_ids.location_id
|
||||
quant = self.move_raw_ids.lot_ids.quant_ids.filtered(lambda q: q.location_id.id == location_id.id)
|
||||
if quant.reserved_quantity == 0:
|
||||
self.env['stock.quant']._update_reserved_quantity(
|
||||
self.move_raw_ids.product_id,
|
||||
location_id,
|
||||
quant.quantity,
|
||||
lot_id=quant.lot_id,
|
||||
)
|
||||
record.production_id.button_mark_done1()
|
||||
# record.production_id.state = 'done'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user