fix: parent item should not appear in raw material request dialog (#20216)
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index 3462002..e7cbf40 100755
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -376,6 +376,9 @@
def get_work_order_items(self, for_raw_material_request=0):
'''Returns items with BOM that already do not have a linked work order'''
items = []
+ item_codes = [i.item_code for i in self.items]
+ product_bundle_parents = [pb.new_item_code for pb in frappe.get_all("Product Bundle", {"new_item_code": ["in", item_codes]}, ["new_item_code"])]
+
for table in [self.items, self.packed_items]:
for i in table:
bom = get_default_bom_item(i.item_code)
@@ -387,7 +390,7 @@
else:
pending_qty = stock_qty
- if pending_qty:
+ if pending_qty and i.item_code not in product_bundle_parents:
if bom:
items.append(dict(
name= i.name,