From 2c9b995c71c614c3aaf7cfe778895e64447289bd Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 15 Nov 2021 20:01:37 +0530 Subject: [PATCH] fix: remove item-item group name validation (#28392) (#28399) (cherry picked from commit 043e3255d66d3919fb7317218760fa181be87c5f) Co-authored-by: Rohan --- erpnext/setup/doctype/item_group/item_group.py | 5 ----- erpnext/stock/doctype/item/item.py | 7 ------- 2 files changed, 12 deletions(-) diff --git a/erpnext/setup/doctype/item_group/item_group.py b/erpnext/setup/doctype/item_group/item_group.py index b69d9b0e4c8f..59ef566a5883 100644 --- a/erpnext/setup/doctype/item_group/item_group.py +++ b/erpnext/setup/doctype/item_group/item_group.py @@ -41,7 +41,6 @@ def validate(self): def on_update(self): NestedSet.on_update(self) invalidate_cache_for(self) - self.validate_name_with_item() self.validate_one_root() self.delete_child_item_groups_key() @@ -65,10 +64,6 @@ def on_trash(self): WebsiteGenerator.on_trash(self) self.delete_child_item_groups_key() - def validate_name_with_item(self): - if frappe.db.exists("Item", self.name): - frappe.throw(frappe._("An item exists with same name ({0}), please change the item group name or rename the item").format(self.name), frappe.NameError) - def get_context(self, context): context.show_search = True context.body_class = "product-page" diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index 2778a9a8cf5e..8f2985e2c21f 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -131,7 +131,6 @@ def validate(self): def on_update(self): invalidate_cache_for_item(self) - self.validate_name_with_item_group() self.update_variants() self.update_item_price() self.update_website_item() @@ -377,12 +376,6 @@ def stock_ledger_created(self): where item_code = %s and is_cancelled = 0 limit 1""", self.name)) return self._stock_ledger_created - def validate_name_with_item_group(self): - # causes problem with tree build - if frappe.db.exists("Item Group", self.name): - frappe.throw( - _("An Item Group exists with same name, please change the item name or rename the item group")) - def update_item_price(self): frappe.db.sql(""" UPDATE `tabItem Price`