From 8554cbf001df9c332d4777ea6ba8f17c02c83360 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 20 Aug 2015 16:24:40 +0530 Subject: [PATCH] [minor] fixed patch item template attributes --- erpnext/patches/v5_7/item_template_attributes.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/erpnext/patches/v5_7/item_template_attributes.py b/erpnext/patches/v5_7/item_template_attributes.py index 0bd1e08e167..e93bfe45a41 100644 --- a/erpnext/patches/v5_7/item_template_attributes.py +++ b/erpnext/patches/v5_7/item_template_attributes.py @@ -65,6 +65,12 @@ def migrate_item_variants(): item_attributes = frappe.db.sql("""select distinct item_attribute, item_attribute_value from `tabItem Variant` where parent=%s""", item.name) + if not item_attributes and not all_variants: + item = frappe.get_doc("Item", item.name) + item.has_variants = 0 + item.save() + continue + attribute_value_options = {} for attribute, value in item_attributes: attribute_value_options.setdefault(attribute, []).append(value)