diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py index 5fd933b3d98..1d8d9dbcef5 100644 --- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py @@ -34,6 +34,9 @@ class PricingRule(Document): def validate_duplicate_apply_on(self): 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)] 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', filters = {'parent': ('in', items), 'uom': ("like", "{0}%".format(txt))}, - fields = ["distinct uom"], as_list=1) \ No newline at end of file + fields = ["distinct uom"], as_list=1)