From 3f2604eff69c29c4bcb28a409821f4ea3948a797 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Mon, 29 Jun 2015 15:06:46 +0530 Subject: [PATCH] Patch for Item Variants --- erpnext/patches.txt | 2 +- erpnext/patches/v5_0/item_variants.py | 11 +++++++++++ erpnext/stock/doctype/item/item.json | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 erpnext/patches/v5_0/item_variants.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 0f32a6dbf6..80965ece06 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 0000000000..fd4e4bbe0c --- /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 9e7fb3dabe..a43b70467d 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",