diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index 9f5a7733..0156fa81 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -645,6 +645,16 @@ class StockPicking(models.Model): stock_picking = stock_picking_list.filtered(lambda p: p.state not in ("done", "cancel")) if sale_id and not stock_picking: 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 # 创建 外协出库入单