Merge pull request #55805 from mihir-kandoi/product-bundle-disabled-v16

feat(selling): surface and respect disabled Product Bundles (backport #55791)
This commit is contained in:
Mihir Kandoi
2026-06-10 21:58:33 +05:30
committed by GitHub
4 changed files with 21 additions and 3 deletions

View File

@@ -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",

View File

@@ -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",

View File

@@ -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"];
},
};

View File

@@ -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"):