Browse Source

fix: remove item-item group name validation (#28392)

develop
Rohan 3 years ago
committed by GitHub
parent
commit
043e3255d6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      erpnext/setup/doctype/item_group/item_group.py
  2. 7
      erpnext/stock/doctype/item/item.py

5
erpnext/setup/doctype/item_group/item_group.py

@ -43,7 +43,6 @@ class ItemGroup(NestedSet, WebsiteGenerator):
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()
@ -67,10 +66,6 @@ class ItemGroup(NestedSet, WebsiteGenerator):
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.page_length = cint(frappe.db.get_single_value('Products Settings', 'products_per_page')) or 6

7
erpnext/stock/doctype/item/item.py

@ -152,7 +152,6 @@ class Item(WebsiteGenerator):
def on_update(self):
invalidate_cache_for_item(self)
self.validate_name_with_item_group()
self.update_variants()
self.update_item_price()
self.update_template_item()
@ -628,12 +627,6 @@ class Item(WebsiteGenerator):
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`

Loading…
Cancel
Save