修复成品调拨出库订单的状态没变
This commit is contained in:
@@ -654,10 +654,7 @@ class StockPicking(models.Model):
|
|||||||
if self.location_id.name == '成品存货区' and self.location_dest_id.name == '客户':
|
if self.location_id.name == '成品存货区' and self.location_dest_id.name == '客户':
|
||||||
sale_id = self.env['sale.order'].sudo().search(
|
sale_id = self.env['sale.order'].sudo().search(
|
||||||
[('name', '=', self.origin)])
|
[('name', '=', self.origin)])
|
||||||
check_backorder = self._pre_action_done_hook()
|
if sale_id and res:
|
||||||
if check_backorder is not True:
|
|
||||||
return res
|
|
||||||
if sale_id:
|
|
||||||
sale_id.write({'state': 'delivered'})
|
sale_id.write({'state': 'delivered'})
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@@ -674,12 +671,14 @@ class StockPicking(models.Model):
|
|||||||
})
|
})
|
||||||
move_dest_id = False
|
move_dest_id = False
|
||||||
# 如果当前工单是是制造订单的最后一个工艺外协工单
|
# 如果当前工单是是制造订单的最后一个工艺外协工单
|
||||||
if workorder == next((workorder for workorder in reversed(sorted_workorders) if workorder.is_subcontract), None):
|
if workorder == next((workorder for workorder in reversed(sorted_workorders) if workorder.is_subcontract),
|
||||||
|
None):
|
||||||
move_dest_id = item.move_raw_ids[0].id
|
move_dest_id = item.move_raw_ids[0].id
|
||||||
else:
|
else:
|
||||||
# 从sorted_workorders中找到上一工单的move
|
# 从sorted_workorders中找到上一工单的move
|
||||||
if len(sorted_workorders) > 1:
|
if len(sorted_workorders) > 1:
|
||||||
move_dest_id = sorted_workorders[sorted_workorders.index(workorder)+1].move_subcontract_workorder_ids[1].id
|
move_dest_id = \
|
||||||
|
sorted_workorders[sorted_workorders.index(workorder) + 1].move_subcontract_workorder_ids[1].id
|
||||||
new_picking = True
|
new_picking = True
|
||||||
outcontract_picking_type_in = self.env.ref(
|
outcontract_picking_type_in = self.env.ref(
|
||||||
'sf_manufacturing.outcontract_picking_in').id,
|
'sf_manufacturing.outcontract_picking_in').id,
|
||||||
@@ -705,9 +704,6 @@ class StockPicking(models.Model):
|
|||||||
{'picking_id': picking_out.id, 'state': 'waiting'})
|
{'picking_id': picking_out.id, 'state': 'waiting'})
|
||||||
moves_out._assign_picking_post_process(new=new_picking)
|
moves_out._assign_picking_post_process(new=new_picking)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@api.depends('move_type', 'immediate_transfer', 'move_ids.state', 'move_ids.picking_id')
|
@api.depends('move_type', 'immediate_transfer', 'move_ids.state', 'move_ids.picking_id')
|
||||||
def _compute_state(self):
|
def _compute_state(self):
|
||||||
super(StockPicking, self)._compute_state()
|
super(StockPicking, self)._compute_state()
|
||||||
|
|||||||
Reference in New Issue
Block a user