(cherry picked from commit 043e3255d6)
Co-authored-by: Rohan <Alchez@users.noreply.github.com>
This commit is contained in:
@@ -41,7 +41,6 @@ class ItemGroup(NestedSet, WebsiteGenerator):
|
|||||||
def on_update(self):
|
def on_update(self):
|
||||||
NestedSet.on_update(self)
|
NestedSet.on_update(self)
|
||||||
invalidate_cache_for(self)
|
invalidate_cache_for(self)
|
||||||
self.validate_name_with_item()
|
|
||||||
self.validate_one_root()
|
self.validate_one_root()
|
||||||
self.delete_child_item_groups_key()
|
self.delete_child_item_groups_key()
|
||||||
|
|
||||||
@@ -65,10 +64,6 @@ class ItemGroup(NestedSet, WebsiteGenerator):
|
|||||||
WebsiteGenerator.on_trash(self)
|
WebsiteGenerator.on_trash(self)
|
||||||
self.delete_child_item_groups_key()
|
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):
|
def get_context(self, context):
|
||||||
context.show_search = True
|
context.show_search = True
|
||||||
context.body_class = "product-page"
|
context.body_class = "product-page"
|
||||||
|
|||||||
@@ -131,7 +131,6 @@ class Item(Document):
|
|||||||
|
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
invalidate_cache_for_item(self)
|
invalidate_cache_for_item(self)
|
||||||
self.validate_name_with_item_group()
|
|
||||||
self.update_variants()
|
self.update_variants()
|
||||||
self.update_item_price()
|
self.update_item_price()
|
||||||
self.update_website_item()
|
self.update_website_item()
|
||||||
@@ -377,12 +376,6 @@ class Item(Document):
|
|||||||
where item_code = %s and is_cancelled = 0 limit 1""", self.name))
|
where item_code = %s and is_cancelled = 0 limit 1""", self.name))
|
||||||
return self._stock_ledger_created
|
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):
|
def update_item_price(self):
|
||||||
frappe.db.sql("""
|
frappe.db.sql("""
|
||||||
UPDATE `tabItem Price`
|
UPDATE `tabItem Price`
|
||||||
|
|||||||
Reference in New Issue
Block a user