From ee0cc7040a6d6f1e6e8ccfc6b54e71f9f58d2d79 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 13 Apr 2026 17:10:37 +0530 Subject: [PATCH] fix: not able to submit the PO (cherry picked from commit 1e43c374528732391fd960129dc9c78bbe8104ba) # Conflicts: # erpnext/controllers/status_updater.py --- erpnext/controllers/status_updater.py | 46 +++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/erpnext/controllers/status_updater.py b/erpnext/controllers/status_updater.py index c28a8ff44fc..55c67223a4e 100644 --- a/erpnext/controllers/status_updater.py +++ b/erpnext/controllers/status_updater.py @@ -270,6 +270,52 @@ class StatusUpdater(Document): args["name"], as_dict=1, ) +<<<<<<< HEAD +======= + + if items_to_validate: + pp_sub_assembly_items = [ + item.production_plan_sub_assembly_item + for item in items_to_validate + if item.production_plan_sub_assembly_item + ] + + pp_subcontract_items = [] + if pp_sub_assembly_items: + pp_subcontract_items = frappe.db.get_all( + "Production Plan Sub Assembly Item", + filters={ + "name": ("in", pp_sub_assembly_items), + "type_of_manufacturing": "Subcontract", + }, + pluck="name", + ) + + regular_items = [] + pp_items = [] + + for item in items_to_validate: + if item.production_plan_sub_assembly_item in pp_subcontract_items: + pp_items.append(item.name) + else: + regular_items.append(item.name) + + item_details = [] + + # Query regular items with item_code field + if regular_items: + item_details.extend(self.fetch_items_with_pending_qty(args, "item_code", regular_items)) + + # Query production plan items with production_item field + if pp_items and args.get("target_dt") in ["Production Plan Sub Assembly Item"]: + item_details.extend(self.fetch_items_with_pending_qty(args, "production_item", pp_items)) + + item_lookup = {item.name: item for item in item_details} + + for child_item in items_to_validate: + item = item_lookup.get(child_item.name) + +>>>>>>> 1e43c37452 (fix: not able to submit the PO) if item: item = item[0] item["idx"] = d.idx