test: Pricing rule test for transactions
This commit is contained in:
parent
a6e26cce87
commit
22e8ae9dac
@ -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():
|
||||
|
Loading…
Reference in New Issue
Block a user