Merge pull request #17503 from netchampfaris/fix-product-configurator

fix: Dont include disabled items in cache
diff --git a/erpnext/portal/product_configurator/item_variants_cache.py b/erpnext/portal/product_configurator/item_variants_cache.py
index 0e0b8c9..f33c8d6 100644
--- a/erpnext/portal/product_configurator/item_variants_cache.py
+++ b/erpnext/portal/product_configurator/item_variants_cache.py
@@ -66,15 +66,14 @@
 			as_list=1
 		)
 
-		disabled_items = [i.name for i in frappe.db.get_all('Item', {'disabled': 1})]
+		disabled_items = set([i.name for i in frappe.db.get_all('Item', {'disabled': 1})])
 
 		attribute_value_item_map = frappe._dict({})
 		item_attribute_value_map = frappe._dict({})
 
+		item_variants_data = [r for r in item_variants_data if r[0] not in disabled_items]
 		for row in item_variants_data:
 			item_code, attribute, attribute_value = row
-			if item_code in disabled_items:
-				continue
 			# (attr, value) => [item1, item2]
 			attribute_value_item_map.setdefault((attribute, attribute_value), []).append(item_code)
 			# item => {attr1: value1, attr2: value2}
diff --git a/erpnext/portal/product_configurator/utils.py b/erpnext/portal/product_configurator/utils.py
index 405a6d8..15d5e9f 100644
--- a/erpnext/portal/product_configurator/utils.py
+++ b/erpnext/portal/product_configurator/utils.py
@@ -257,7 +257,8 @@
 
 	items = []
 	for attribute, value in selected_attributes.items():
-		items.append(set(attribute_value_item_map[(attribute, value)]))
+		filtered_items = attribute_value_item_map.get((attribute, value), [])
+		items.append(set(filtered_items))
 
 	return set.intersection(*items)