test(manufacturing): cover BOM item search when item code collides with a barcode

This commit is contained in:
Kaushal Shriwas
2026-08-11 11:58:36 +05:30
parent bf5d506637
commit 23024d1ea9

View File

@@ -530,6 +530,29 @@ class TestBOM(ERPNextTestSuite):
self.assertNotEqual(len(test_items), len(filtered), msg="Item filtering showing excessive results")
self.assertTrue(0 < len(filtered) <= 3, msg="Item filtering showing excessive results")
@timeout
def test_bom_item_query_matches_item_code_colliding_with_another_barcode(self):
item = make_item(
"_Test BOM Query 2.5MM",
{"is_stock_item": 1, "item_name": "_Test BOM Query Sheet", "description": "sheet"},
)
make_item(
"_Test BOM Query Barcode Holder",
{"is_stock_item": 1},
barcode=f"90{item.name}90",
)
results = item_query(
doctype="Item",
txt=item.name,
searchfield="name",
start=0,
page_len=20,
filters={"is_stock_item": 1},
)
self.assertIn(item.name, [d[0] for d in results])
@timeout
def test_exclude_exploded_items_from_bom(self):
bom_no = get_default_bom()