mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-16 16:08:39 +00:00
feat(selling): surface and respect disabled Product Bundles (backport #55791)
Partial backport of frappe/erpnext#55791 to version-16-hotfix. On v16, Product Bundle is neither submittable nor versioned and every resolution path (packing, POS, item details, selling controller) already filters `disabled: 0`, so only the user-facing gaps are backported: - the "Get Items from Product Bundle" dialog no longer offers disabled bundles - list view indicator: Disabled (grey) / Active (green) - Product Bundle Balance report excludes disabled bundles - `disabled` field gets a description, standard filter and no_copy (a copied bundle starts enabled) The develop-only parts (un-deprecating the field, `is_active`/docstatus handling, the version picker filter and the disabled-version validation on transaction rows) have no v16 equivalent and are intentionally dropped. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -611,6 +611,9 @@ erpnext.buying.get_items_from_product_bundle = function (frm) {
|
|||||||
fieldname: "product_bundle",
|
fieldname: "product_bundle",
|
||||||
options: "Product Bundle",
|
options: "Product Bundle",
|
||||||
reqd: 1,
|
reqd: 1,
|
||||||
|
get_query: () => {
|
||||||
|
return { filters: { disabled: 0 } };
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldtype: "Currency",
|
fieldtype: "Currency",
|
||||||
|
|||||||
@@ -65,9 +65,12 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "0",
|
"default": "0",
|
||||||
|
"description": "A disabled Product Bundle cannot be selected in transactions.",
|
||||||
"fieldname": "disabled",
|
"fieldname": "disabled",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Disabled"
|
"in_standard_filter": 1,
|
||||||
|
"label": "Disabled",
|
||||||
|
"no_copy": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "column_break_eonk",
|
"fieldname": "column_break_eonk",
|
||||||
@@ -77,7 +80,7 @@
|
|||||||
"icon": "fa fa-sitemap",
|
"icon": "fa fa-sitemap",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2024-03-27 13:10:19.599302",
|
"modified": "2026-06-10 16:00:00.000000",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Selling",
|
"module": "Selling",
|
||||||
"name": "Product Bundle",
|
"name": "Product Bundle",
|
||||||
|
|||||||
@@ -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"];
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -140,7 +140,7 @@ def get_items(filters):
|
|||||||
item.brand,
|
item.brand,
|
||||||
item.stock_uom,
|
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"):
|
if item_code := filters.get("item_code"):
|
||||||
@@ -182,7 +182,7 @@ def get_items(filters):
|
|||||||
pbi.uom,
|
pbi.uom,
|
||||||
pbi.qty,
|
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)
|
).run(as_dict=1)
|
||||||
|
|
||||||
child_items = set()
|
child_items = set()
|
||||||
|
|||||||
Reference in New Issue
Block a user