diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 0f32a6dbf68..80965ece06b 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -168,4 +168,4 @@ execute:frappe.delete_doc("Page", "users") erpnext.patches.v5_0.update_material_transferred_for_manufacturing_again erpnext.patches.v5_0.index_on_account_and_gl_entry execute:frappe.db.sql("""delete from `tabProject Task`""") - +erpnext.patches.v5_0.item_variants diff --git a/erpnext/patches/v5_0/item_variants.py b/erpnext/patches/v5_0/item_variants.py new file mode 100644 index 00000000000..fd4e4bbe0c5 --- /dev/null +++ b/erpnext/patches/v5_0/item_variants.py @@ -0,0 +1,11 @@ +import frappe + +def execute(): + frappe.reload_doctype("Item") + for d in frappe.get_list("Item", filters={"has_variants":1}): + manage_variant = frappe.new_doc("Manage Variants") + manage_variant.item = d.name + manage_variant.attributes = frappe.db.sql("select item_attribute as attribute, item_attribute_value as attribute_value \ + from `tabItem Variant` where parent = %s", d.name, as_dict=1) + manage_variant.generate_combinations() + manage_variant.create_variants() \ No newline at end of file diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json index 9e7fb3dabec..a43b70467d0 100644 --- a/erpnext/stock/doctype/item/item.json +++ b/erpnext/stock/doctype/item/item.json @@ -902,7 +902,7 @@ "icon": "icon-tag", "idx": 1, "max_attachments": 1, - "modified": "2015-06-26 17:20:18.204558", + "modified": "2015-06-29 17:20:18.204558", "modified_by": "Administrator", "module": "Stock", "name": "Item",