From 39ed32f3e9d04209e6cdfb97c3cdaaab0cd8115e Mon Sep 17 00:00:00 2001 From: guanhuan Date: Tue, 31 Dec 2024 13:08:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=88=90=E5=93=81=E8=B0=83?= =?UTF-8?q?=E6=8B=A8=E5=87=BA=E5=BA=93=E8=AE=A2=E5=8D=95=E7=9A=84=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=B2=A1=E5=8F=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/stock.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index 2dcab4be..fa723283 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -654,7 +654,10 @@ 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)]) - if sale_id and res: + stock_picking_list = self.env['stock.picking'].sudo().search( + [('id', 'in', sale_id.picking_ids.ids)]) + 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'}) return res @@ -678,7 +681,7 @@ class StockPicking(models.Model): # 从sorted_workorders中找到上一工单的move if len(sorted_workorders) > 1: move_dest_id = \ - sorted_workorders[sorted_workorders.index(workorder) + 1].move_subcontract_workorder_ids[1].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,