From 02c11b6becd3c425e4adcda9a32cbb92fa86d47e Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Mon, 22 Jun 2026 15:53:52 +0530 Subject: [PATCH] fix: address product bundle review comments (cherry picked from commit d48a1e0d1698bb1fcba38584ba4623f9acddba9e) --- .../doctype/product_bundle/product_bundle_list.js | 2 +- .../doctype/product_bundle/test_product_bundle.py | 9 +++++++++ .../stock/report/item_where_used/item_where_used.py | 13 +++++++++---- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/erpnext/selling/doctype/product_bundle/product_bundle_list.js b/erpnext/selling/doctype/product_bundle/product_bundle_list.js index 9830cd2d45c..d7bc3d8f0f4 100644 --- a/erpnext/selling/doctype/product_bundle/product_bundle_list.js +++ b/erpnext/selling/doctype/product_bundle/product_bundle_list.js @@ -14,7 +14,7 @@ frappe.listview_settings["Product Bundle"] = { return [__("Active"), "green", "is_active,=,1|disabled,=,0|docstatus,=,1"]; } if (doc.docstatus === 1 && !doc.is_active) { - return [__("Inactive"), "gray", "is_active,=,0|disabled,=,0|docstatus,=,1"]; + return [__("Inactive"), "gray", "is_active,=,0|docstatus,=,1"]; } >>>>>>> a218b8db8c (fix: submittable product bundle issues) }, diff --git a/erpnext/selling/doctype/product_bundle/test_product_bundle.py b/erpnext/selling/doctype/product_bundle/test_product_bundle.py index 13c92531c4b..2d13e1a3e6a 100644 --- a/erpnext/selling/doctype/product_bundle/test_product_bundle.py +++ b/erpnext/selling/doctype/product_bundle/test_product_bundle.py @@ -144,6 +144,15 @@ class TestProductBundle(ERPNextTestSuite): self.assertEqual(rows[0].stock_quantity, rows[0].quantity) self.assertEqual(rows[0].stock_uom, rows[0].uom) + def test_item_where_used_report_hides_false_check_columns(self): + from erpnext.stock.report.item_where_used.item_where_used import get_columns + + columns = get_columns([frappe._dict(stock_quantity=0, is_default=0)]) + fieldnames = [column["fieldname"] for column in columns] + + self.assertIn("stock_quantity", fieldnames) + self.assertNotIn("is_default", fieldnames) + def test_child_cannot_be_active_bundle(self): make_product_bundle(self.parent, ["_Test PB Child A"]) outer = make_item("_Test PB Outer", {"is_stock_item": 0, "is_sales_item": 1}).name diff --git a/erpnext/stock/report/item_where_used/item_where_used.py b/erpnext/stock/report/item_where_used/item_where_used.py index 13aba1685ec..06247627d98 100644 --- a/erpnext/stock/report/item_where_used/item_where_used.py +++ b/erpnext/stock/report/item_where_used/item_where_used.py @@ -483,18 +483,23 @@ def hide_empty_optional_columns(columns, data): fields_with_values = set() for row in data: - for fieldname in optional_fields: - if field_has_value(row, fieldname): - fields_with_values.add(fieldname) + for column in columns: + fieldname = column["fieldname"] + if fieldname in optional_fields and field_has_value(row, column): + fields_with_values.add(column["fieldname"]) return [column for column in columns if column["fieldname"] not in optional_fields - fields_with_values] -def field_has_value(row, fieldname): +def field_has_value(row, column): + fieldname = column["fieldname"] if fieldname not in row: return False value = row.get(fieldname) + if column.get("fieldtype") == "Check": + return bool(value) + return value is not None and value != ""