diff --git a/erpnext/public/js/controllers/buying.js b/erpnext/public/js/controllers/buying.js index aa4f5b70b9e..0e5b0031078 100644 --- a/erpnext/public/js/controllers/buying.js +++ b/erpnext/public/js/controllers/buying.js @@ -611,6 +611,9 @@ erpnext.buying.get_items_from_product_bundle = function (frm) { fieldname: "product_bundle", options: "Product Bundle", reqd: 1, + get_query: () => { + return { filters: { disabled: 0 } }; + }, }, { fieldtype: "Currency", diff --git a/erpnext/selling/doctype/product_bundle/product_bundle.json b/erpnext/selling/doctype/product_bundle/product_bundle.json index 9cb95aefe05..de335c55fca 100644 --- a/erpnext/selling/doctype/product_bundle/product_bundle.json +++ b/erpnext/selling/doctype/product_bundle/product_bundle.json @@ -65,9 +65,12 @@ }, { "default": "0", + "description": "A disabled Product Bundle cannot be selected in transactions.", "fieldname": "disabled", "fieldtype": "Check", - "label": "Disabled" + "in_standard_filter": 1, + "label": "Disabled", + "no_copy": 1 }, { "fieldname": "column_break_eonk", @@ -77,7 +80,7 @@ "icon": "fa fa-sitemap", "idx": 1, "links": [], - "modified": "2024-03-27 13:10:19.599302", + "modified": "2026-06-10 16:00:00.000000", "modified_by": "Administrator", "module": "Selling", "name": "Product Bundle", diff --git a/erpnext/selling/doctype/product_bundle/product_bundle_list.js b/erpnext/selling/doctype/product_bundle/product_bundle_list.js new file mode 100644 index 00000000000..b6788bacf10 --- /dev/null +++ b/erpnext/selling/doctype/product_bundle/product_bundle_list.js @@ -0,0 +1,12 @@ +// Copyright (c) 2026, Frappe Technologies Pvt. Ltd. and Contributors +// License: GNU General Public License v3. See license.txt + +frappe.listview_settings["Product Bundle"] = { + add_fields: ["disabled"], + get_indicator(doc) { + if (doc.disabled) { + return [__("Disabled"), "grey", "disabled,=,1"]; + } + return [__("Active"), "green", "disabled,=,0"]; + }, +}; diff --git a/erpnext/stock/report/product_bundle_balance/product_bundle_balance.py b/erpnext/stock/report/product_bundle_balance/product_bundle_balance.py index 5a8960396b3..c7ba791dfea 100644 --- a/erpnext/stock/report/product_bundle_balance/product_bundle_balance.py +++ b/erpnext/stock/report/product_bundle_balance/product_bundle_balance.py @@ -140,7 +140,7 @@ def get_items(filters): item.brand, item.stock_uom, ) - .where(IfNull(item.disabled, 0) == 0) + .where((IfNull(item.disabled, 0) == 0) & (IfNull(pb.disabled, 0) == 0)) ) if item_code := filters.get("item_code"): @@ -182,7 +182,7 @@ def get_items(filters): pbi.uom, pbi.qty, ) - .where(pb.new_item_code.isin(parent_items)) + .where(pb.new_item_code.isin(parent_items) & (IfNull(pb.disabled, 0) == 0)) ).run(as_dict=1) child_items = set()