出入库单状态修复
This commit is contained in:
@@ -434,6 +434,12 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
def button_start(self):
|
def button_start(self):
|
||||||
if self.routing_type == '装夹':
|
if self.routing_type == '装夹':
|
||||||
self.pro_code = self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name
|
self.pro_code = self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name
|
||||||
|
# 外协出库单,从“正在等待”变为“就绪”状态
|
||||||
|
if self.is_subcontract is True:
|
||||||
|
picking_out = self.env['stock.picking'].search([('id', '=', self.picking_out_id.id)])
|
||||||
|
if picking_out:
|
||||||
|
if picking_out.state == 'confirmed':
|
||||||
|
picking_out.write({'state': 'assigned'})
|
||||||
if self.state == 'waiting' or self.state == 'ready' or self.state == 'progress':
|
if self.state == 'waiting' or self.state == 'ready' or self.state == 'progress':
|
||||||
self.move_raw_ids = self.production_id.move_raw_ids
|
self.move_raw_ids = self.production_id.move_raw_ids
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
@@ -479,11 +485,6 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
if self.date_planned_finished and self.date_planned_finished < start_date:
|
if self.date_planned_finished and self.date_planned_finished < start_date:
|
||||||
vals['date_planned_finished'] = start_date
|
vals['date_planned_finished'] = start_date
|
||||||
return self.write(vals)
|
return self.write(vals)
|
||||||
# 外协出库单,从“正在等待”变为“就绪”状态
|
|
||||||
if self.is_subcontract is True:
|
|
||||||
picking_out = self.env['stock.picking'].search([('id', '=', self.picking_out_id.id)])
|
|
||||||
if picking_out:
|
|
||||||
picking_out.write({'state': 'assigned'})
|
|
||||||
else:
|
else:
|
||||||
raise UserError(_('请先完成上一步工单'))
|
raise UserError(_('请先完成上一步工单'))
|
||||||
|
|
||||||
|
|||||||
@@ -290,8 +290,8 @@ class StockPicking(models.Model):
|
|||||||
moves_in._get_new_picking_values_Res(item, sorted_workorders, 'WH/OCIN/'))
|
moves_in._get_new_picking_values_Res(item, sorted_workorders, 'WH/OCIN/'))
|
||||||
picking_out = self.env['stock.picking'].create(
|
picking_out = self.env['stock.picking'].create(
|
||||||
moves_out._get_new_picking_values_Res(item, sorted_workorders, 'WH/OCOUT/'))
|
moves_out._get_new_picking_values_Res(item, sorted_workorders, 'WH/OCOUT/'))
|
||||||
moves_in.write({'picking_id': picking_in.id})
|
moves_in.write({'picking_id': picking_in.id, 'state': 'confirmed'})
|
||||||
moves_out.write({'picking_id': picking_out.id})
|
moves_out.write({'picking_id': picking_out.id, 'state': 'confirmed'})
|
||||||
moves_in._assign_picking_post_process(new=new_picking)
|
moves_in._assign_picking_post_process(new=new_picking)
|
||||||
moves_out._assign_picking_post_process(new=new_picking)
|
moves_out._assign_picking_post_process(new=new_picking)
|
||||||
m += 1
|
m += 1
|
||||||
@@ -315,4 +315,3 @@ class ReStockMove(models.Model):
|
|||||||
'location_dest_id': self.mapped('location_dest_id').id,
|
'location_dest_id': self.mapped('location_dest_id').id,
|
||||||
'state': 'confirmed',
|
'state': 'confirmed',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user