修复成品调拨出库订单的状态没变
This commit is contained in:
@@ -654,11 +654,8 @@ class StockPicking(models.Model):
|
||||
if self.location_id.name == '成品存货区' and self.location_dest_id.name == '客户':
|
||||
sale_id = self.env['sale.order'].sudo().search(
|
||||
[('name', '=', self.origin)])
|
||||
check_backorder = self._pre_action_done_hook()
|
||||
if check_backorder is not True:
|
||||
return res
|
||||
if sale_id:
|
||||
sale_id.write({'state':'delivered'})
|
||||
if sale_id and res:
|
||||
sale_id.write({'state': 'delivered'})
|
||||
return res
|
||||
|
||||
# 创建 外协出库入单
|
||||
@@ -674,12 +671,14 @@ class StockPicking(models.Model):
|
||||
})
|
||||
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
|
||||
else:
|
||||
# 从sorted_workorders中找到上一工单的move
|
||||
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
|
||||
outcontract_picking_type_in = self.env.ref(
|
||||
'sf_manufacturing.outcontract_picking_in').id,
|
||||
@@ -705,9 +704,6 @@ class StockPicking(models.Model):
|
||||
{'picking_id': picking_out.id, 'state': 'waiting'})
|
||||
moves_out._assign_picking_post_process(new=new_picking)
|
||||
|
||||
|
||||
|
||||
|
||||
@api.depends('move_type', 'immediate_transfer', 'move_ids.state', 'move_ids.picking_id')
|
||||
def _compute_state(self):
|
||||
super(StockPicking, self)._compute_state()
|
||||
|
||||
Reference in New Issue
Block a user