成品入库单已经完成-工单还有【回退】按钮-还能回退成功 问题处理
This commit is contained in:
@@ -645,6 +645,16 @@ class StockPicking(models.Model):
|
|||||||
stock_picking = stock_picking_list.filtered(lambda p: p.state not in ("done", "cancel"))
|
stock_picking = stock_picking_list.filtered(lambda p: p.state not in ("done", "cancel"))
|
||||||
if sale_id and not stock_picking:
|
if sale_id and not stock_picking:
|
||||||
sale_id.write({'state': 'delivered'})
|
sale_id.write({'state': 'delivered'})
|
||||||
|
if self.location_dest_id.name == '成品存货区' and self.state == 'done':
|
||||||
|
for move in self.move_ids:
|
||||||
|
for production in self.sale_order_id.mrp_production_ids:
|
||||||
|
moves = self.env['stock.move'].search([
|
||||||
|
('name', '=', production.name),
|
||||||
|
('state', '!=', 'cancel')
|
||||||
|
])
|
||||||
|
finish_move = next((move for move in moves if move.location_dest_id.name == '制造后'), None)
|
||||||
|
if finish_move.id in move.move_orig_ids.ids and finish_move.state == 'done':
|
||||||
|
production.workorder_ids.write({'back_button_display': False})
|
||||||
return res
|
return res
|
||||||
|
|
||||||
# 创建 外协出库入单
|
# 创建 外协出库入单
|
||||||
|
|||||||
Reference in New Issue
Block a user