From 4ca948d7eadb37457f7f5bee35e6cc7af3f2553a Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Wed, 1 May 2019 18:19:24 +0530 Subject: [PATCH 1/3] fix: Skip disabled items in product configurator --- erpnext/portal/product_configurator/item_variants_cache.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/erpnext/portal/product_configurator/item_variants_cache.py b/erpnext/portal/product_configurator/item_variants_cache.py index f17639c1e7..7b0ecc7414 100644 --- a/erpnext/portal/product_configurator/item_variants_cache.py +++ b/erpnext/portal/product_configurator/item_variants_cache.py @@ -66,11 +66,15 @@ class ItemVariantsCacheManager: as_list=1 ) + disabled_items = [i.name for i in frappe.db.get_all('Item', {'disabled': 1})] + attribute_value_item_map = frappe._dict({}) item_attribute_value_map = frappe._dict({}) 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} @@ -103,5 +107,6 @@ def build_cache(item_code): def enqueue_build_cache(item_code): if frappe.cache().hget('item_cache_build_in_progress', item_code): + print('caching in progress for', item_code) return frappe.enqueue(build_cache, item_code=item_code, queue='short') From 284e5a284e925cfd9e69d56648247c2cc8d303b6 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 1 May 2019 19:26:56 +0530 Subject: [PATCH 2/3] Update item_variants_cache.py --- erpnext/portal/product_configurator/item_variants_cache.py | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/portal/product_configurator/item_variants_cache.py b/erpnext/portal/product_configurator/item_variants_cache.py index 7b0ecc7414..7c325a1d8d 100644 --- a/erpnext/portal/product_configurator/item_variants_cache.py +++ b/erpnext/portal/product_configurator/item_variants_cache.py @@ -100,7 +100,6 @@ class ItemVariantsCacheManager: def build_cache(item_code): frappe.cache().hset('item_cache_build_in_progress', item_code, 1) - print('ItemVariantsCacheManager: Building cache for', item_code) i = ItemVariantsCacheManager(item_code) i.build_cache() frappe.cache().hset('item_cache_build_in_progress', item_code, 0) From c64cc331b7739284c58c68d55541a84825fb6d4b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 1 May 2019 19:27:23 +0530 Subject: [PATCH 3/3] Update item_variants_cache.py --- erpnext/portal/product_configurator/item_variants_cache.py | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/portal/product_configurator/item_variants_cache.py b/erpnext/portal/product_configurator/item_variants_cache.py index 7c325a1d8d..39f0803812 100644 --- a/erpnext/portal/product_configurator/item_variants_cache.py +++ b/erpnext/portal/product_configurator/item_variants_cache.py @@ -106,6 +106,5 @@ def build_cache(item_code): def enqueue_build_cache(item_code): if frappe.cache().hget('item_cache_build_in_progress', item_code): - print('caching in progress for', item_code) return frappe.enqueue(build_cache, item_code=item_code, queue='short')