diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index 061fbbf43e7..42a3c7c2737 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -1403,18 +1403,16 @@ def validate_bom_no(item, bom_no): def _bom_contains_item(bom, item): - item_lower = item.lower() + item = item.lower() for d in bom.items: - if d.item_code.lower() == item_lower: + if d.item_code.lower() == item: return True for d in bom.secondary_items: - if d.item_code.lower() == item_lower: + if d.item_code.lower() == item: 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_lower + bom.item.lower() == item or bom.item.lower() == cstr(frappe.db.get_value("Item", item, "variant_of")).lower() )