Skip to content

Commit

Permalink
Merge pull request #30628 from deepeshgarg007/pricng_rule_test
Browse files Browse the repository at this point in the history
test: Pricing rule test for transactions
  • Loading branch information
deepeshgarg007 authored Apr 7, 2022
2 parents be04eaf + 22e8ae9 commit c9d6618
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions erpnext/accounts/doctype/pricing_rule/pricing_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ def validate(self):
self.margin_rate_or_amount = 0.0

def validate_duplicate_apply_on(self):
field = apply_on_dict.get(self.apply_on)
values = [d.get(frappe.scrub(self.apply_on)) for d in self.get(field) if field]
if len(values) != len(set(values)):
frappe.throw(_("Duplicate {0} found in the table").format(self.apply_on))
if self.apply_on != "Transaction":
field = apply_on_dict.get(self.apply_on)
values = [d.get(frappe.scrub(self.apply_on)) for d in self.get(field) if field]
if len(values) != len(set(values)):
frappe.throw(_("Duplicate {0} found in the table").format(self.apply_on))

def validate_mandatory(self):
for apply_on, field in apply_on_dict.items():
Expand Down

0 comments on commit c9d6618

Please sign in to comment.