From 4bcc2316a93ec68b330569a2aedacc95cad9b39f Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 19 May 2017 12:33:00 +0530 Subject: [PATCH] Don't update variant when template is updated (#8922) * [fix] allow editing of variant properties, reverting earlier fix * [minor] dont automatically update variants when the template is saved --- erpnext/stock/doctype/item/item.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index 3b8f6e4ac7..f2780bf67c 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -100,7 +100,6 @@ class Item(WebsiteGenerator): invalidate_cache_for_item(self) self.validate_name_with_item_group() self.update_item_price() - self.update_variants() self.update_template_item() def add_price(self, price_list=None): @@ -612,23 +611,8 @@ class Item(WebsiteGenerator): if not template_item.show_in_website: template_item.show_in_website = 1 template_item.flags.ignore_permissions = True - template_item.flags.dont_update_variants = True template_item.save() - def update_variants(self): - if self.flags.dont_update_variants: - return - if self.has_variants: - updated = [] - variants = frappe.db.get_all("Item", fields=["item_code"], filters={"variant_of": self.name }) - for d in variants: - variant = frappe.get_doc("Item", d) - copy_attributes_to_variant(self, variant) - variant.save() - updated.append(d.item_code) - if updated: - frappe.msgprint(_("Item Variants {0} updated").format(", ".join(updated))) - def validate_has_variants(self): if not self.has_variants and frappe.db.get_value("Item", self.name, "has_variants"): if frappe.db.exists("Item", {"variant_of": self.name}):