From 4272d2855f4864feab81e2110e34c397f977f3ed Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Tue, 22 Apr 2025 13:38:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9D=AF=E6=96=99=E8=87=AA=E5=8A=A8=E5=8B=BE?= =?UTF-8?q?=E9=80=89=E5=B7=A5=E8=89=BA=E8=B7=AF=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 667251f9..4446fa8d 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -924,6 +924,8 @@ class MrpProduction(models.Model): "bom_id": self[0].bom_id.id, "is_subcontract":True, }) + self[0].bom_id.bom_line_ids.product_id.route_ids = [(4,self.env.ref( + 'sf_stock.stock_location_outsourcing_material_receiving_area').id)] for product_id, request_line_list in grouped_purchase_request_line_sorted_list.items(): cur_request_line = request_line_list[0] cur_request_line['product_qty'] = len(request_line_list) @@ -943,6 +945,7 @@ class MrpProduction(models.Model): product_id_to_production_names[product_id] = [p.name for p in pd] sorted_workorders = None purchase_request_line = [] + all_workorders = [] for production in production_all: proc_workorders = [] process_parameter_workorder = self.env['mrp.workorder'].search( @@ -962,8 +965,10 @@ class MrpProduction(models.Model): # self.env['purchase.order'].get_purchase_order(workorders, production, product_id_to_production_names) purchase_request_line = purchase_request_line + self.env['purchase.order'].get_purchase_request( workorders, production) + all_workorders += workorders self._create_subcontract_purchase_request(purchase_request_line) - + for workorder in all_workorders: + workorder._compute_pr_mp_count() # 工单排序 def _reset_work_order_sequence1(self, k): for rec in self: