From 22e8ae9dac1bbe83806b27fcc998765f263075ef Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Thu, 7 Apr 2022 13:20:53 +0530 Subject: [PATCH] test: Pricing rule test for transactions --- erpnext/accounts/doctype/pricing_rule/pricing_rule.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py index c45b069730..2438f4b1ab 100644 --- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py @@ -35,10 +35,11 @@ class PricingRule(Document): 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():