mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 08:54:45 +00:00
Skip validate_duplicate_apply_on if not necessary (#20128)
Skip the validation of duplicate fields if the type is transaction, for example.
This commit is contained in:
@@ -34,6 +34,9 @@ class PricingRule(Document):
|
|||||||
|
|
||||||
def validate_duplicate_apply_on(self):
|
def validate_duplicate_apply_on(self):
|
||||||
field = apply_on_dict.get(self.apply_on)
|
field = apply_on_dict.get(self.apply_on)
|
||||||
|
if not field:
|
||||||
|
return False
|
||||||
|
|
||||||
values = [d.get(frappe.scrub(self.apply_on)) for d in self.get(field)]
|
values = [d.get(frappe.scrub(self.apply_on)) for d in self.get(field)]
|
||||||
|
|
||||||
if len(values) != len(set(values)):
|
if len(values) != len(set(values)):
|
||||||
@@ -419,4 +422,4 @@ def get_item_uoms(doctype, txt, searchfield, start, page_len, filters):
|
|||||||
|
|
||||||
return frappe.get_all('UOM Conversion Detail',
|
return frappe.get_all('UOM Conversion Detail',
|
||||||
filters = {'parent': ('in', items), 'uom': ("like", "{0}%".format(txt))},
|
filters = {'parent': ('in', items), 'uom': ("like", "{0}%".format(txt))},
|
||||||
fields = ["distinct uom"], as_list=1)
|
fields = ["distinct uom"], as_list=1)
|
||||||
|
|||||||
Reference in New Issue
Block a user