fix: skip disabled bundles for non-report utils
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index 66dd33a..f240136 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -615,7 +615,7 @@
items_list = [item.item_code for item in self.items]
return frappe.db.get_all(
"Product Bundle",
- filters={"new_item_code": ["in", items_list]},
+ filters={"new_item_code": ["in", items_list], "disabled": 0},
pluck="name",
)
@@ -938,7 +938,7 @@
},
"postprocess": update_item,
"condition": lambda item: (
- not frappe.db.exists("Product Bundle", {"new_item_code": item.item_code})
+ not frappe.db.exists("Product Bundle", {"new_item_code": item.item_code, "disabled": 0})
and flt(item.packed_qty) < flt(item.qty)
),
},
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index d8935fe..cb34497 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -512,8 +512,12 @@
def validate_duplicate_product_bundles_before_merge(self, old_name, new_name):
"Block merge if both old and new items have product bundles."
- old_bundle = frappe.get_value("Product Bundle", filters={"new_item_code": old_name})
- new_bundle = frappe.get_value("Product Bundle", filters={"new_item_code": new_name})
+ old_bundle = frappe.get_value(
+ "Product Bundle", filters={"new_item_code": old_name, "disabled": 0}
+ )
+ new_bundle = frappe.get_value(
+ "Product Bundle", filters={"new_item_code": new_name, "disabled": 0}
+ )
if old_bundle and new_bundle:
bundle_link = get_link_to_form("Product Bundle", old_bundle)
diff --git a/erpnext/stock/doctype/packed_item/packed_item.py b/erpnext/stock/doctype/packed_item/packed_item.py
index 8b6f715..35701c9 100644
--- a/erpnext/stock/doctype/packed_item/packed_item.py
+++ b/erpnext/stock/doctype/packed_item/packed_item.py
@@ -55,7 +55,7 @@
def is_product_bundle(item_code: str) -> bool:
- return bool(frappe.db.exists("Product Bundle", {"new_item_code": item_code}))
+ return bool(frappe.db.exists("Product Bundle", {"new_item_code": item_code, "disabled": 0}))
def get_indexed_packed_items_table(doc):
diff --git a/erpnext/stock/doctype/pick_list/pick_list.py b/erpnext/stock/doctype/pick_list/pick_list.py
index ed20209..644df3d 100644
--- a/erpnext/stock/doctype/pick_list/pick_list.py
+++ b/erpnext/stock/doctype/pick_list/pick_list.py
@@ -368,7 +368,9 @@
frappe.throw("Row #{0}: Item Code is Mandatory".format(item.idx))
if not cint(
frappe.get_cached_value("Item", item.item_code, "is_stock_item")
- ) and not frappe.db.exists("Product Bundle", {"new_item_code": item.item_code}):
+ ) and not frappe.db.exists(
+ "Product Bundle", {"new_item_code": item.item_code, "disabled": 0}
+ ):
continue
item_code = item.item_code
reference = item.sales_order_item or item.material_request_item
@@ -507,7 +509,9 @@
# bundle_item_code: Dict[component, qty]
product_bundle_qty_map = {}
for bundle_item_code in bundles:
- bundle = frappe.get_last_doc("Product Bundle", {"new_item_code": bundle_item_code})
+ bundle = frappe.get_last_doc(
+ "Product Bundle", {"new_item_code": bundle_item_code, "disabled": 0}
+ )
product_bundle_qty_map[bundle_item_code] = {item.item_code: item.qty for item in bundle.items}
return product_bundle_qty_map