Merge pull request #30628 from deepeshgarg007/pricng_rule_test
test: Pricing rule test for transactions
diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
index c45b069..2438f4b 100644
--- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
+++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
@@ -35,10 +35,11 @@
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():