From ead694c9cbfccdbe99702503b87fa47be97d78ed Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Wed, 24 Jun 2026 10:21:29 +0530 Subject: [PATCH] fix(manufacturing): case-sensitive variant BOM lookup on Postgres (#56407) Reapply "fix(manufacturing): case-sensitive variant BOM lookup on Postgres" This reverts commit 1f86b57f942089067539fae67a5c4ac3062f9512. --- erpnext/manufacturing/doctype/bom/bom.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index 42a3c7c2737..061fbbf43e7 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -1403,16 +1403,18 @@ def validate_bom_no(item, bom_no): def _bom_contains_item(bom, item): - item = item.lower() + item_lower = item.lower() for d in bom.items: - if d.item_code.lower() == item: + if d.item_code.lower() == item_lower: return True for d in bom.secondary_items: - if d.item_code.lower() == item: + if d.item_code.lower() == item_lower: return True + # Use the original-cased `item` for the Item lookup: names are case-sensitive on Postgres, + # so a lowercased name would miss the record and drop the variant->template BOM match. return ( - bom.item.lower() == item + bom.item.lower() == item_lower or bom.item.lower() == cstr(frappe.db.get_value("Item", item, "variant_of")).lower() )