mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-01 15:47:06 +00:00
fix: address product bundle review comments
(cherry picked from commit d48a1e0d16)
This commit is contained in:
@@ -14,7 +14,7 @@ frappe.listview_settings["Product Bundle"] = {
|
|||||||
return [__("Active"), "green", "is_active,=,1|disabled,=,0|docstatus,=,1"];
|
return [__("Active"), "green", "is_active,=,1|disabled,=,0|docstatus,=,1"];
|
||||||
}
|
}
|
||||||
if (doc.docstatus === 1 && !doc.is_active) {
|
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)
|
>>>>>>> a218b8db8c (fix: submittable product bundle issues)
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -144,6 +144,15 @@ class TestProductBundle(ERPNextTestSuite):
|
|||||||
self.assertEqual(rows[0].stock_quantity, rows[0].quantity)
|
self.assertEqual(rows[0].stock_quantity, rows[0].quantity)
|
||||||
self.assertEqual(rows[0].stock_uom, rows[0].uom)
|
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):
|
def test_child_cannot_be_active_bundle(self):
|
||||||
make_product_bundle(self.parent, ["_Test PB Child A"])
|
make_product_bundle(self.parent, ["_Test PB Child A"])
|
||||||
outer = make_item("_Test PB Outer", {"is_stock_item": 0, "is_sales_item": 1}).name
|
outer = make_item("_Test PB Outer", {"is_stock_item": 0, "is_sales_item": 1}).name
|
||||||
|
|||||||
@@ -483,18 +483,23 @@ def hide_empty_optional_columns(columns, data):
|
|||||||
|
|
||||||
fields_with_values = set()
|
fields_with_values = set()
|
||||||
for row in data:
|
for row in data:
|
||||||
for fieldname in optional_fields:
|
for column in columns:
|
||||||
if field_has_value(row, fieldname):
|
fieldname = column["fieldname"]
|
||||||
fields_with_values.add(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]
|
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:
|
if fieldname not in row:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
value = row.get(fieldname)
|
value = row.get(fieldname)
|
||||||
|
if column.get("fieldtype") == "Check":
|
||||||
|
return bool(value)
|
||||||
|
|
||||||
return value is not None and value != ""
|
return value is not None and value != ""
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user