mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 16:04:46 +00:00
perf: validate variant change only if value changed
This commit is contained in:
@@ -793,7 +793,10 @@ class Item(Document):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def validate_has_variants(self):
|
def validate_has_variants(self):
|
||||||
if not self.has_variants and frappe.db.get_value("Item", self.name, "has_variants"):
|
if self.is_new():
|
||||||
|
return
|
||||||
|
|
||||||
|
if not self.has_variants and self.has_value_changed("has_variants"):
|
||||||
if frappe.db.exists("Item", {"variant_of": self.name}):
|
if frappe.db.exists("Item", {"variant_of": self.name}):
|
||||||
frappe.throw(_("Item has variants."))
|
frappe.throw(_("Item has variants."))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user