validate pricing rule discount with item max discount
This commit is contained in:
parent
afffd656f6
commit
1b1b3a8fd6
@ -65,7 +65,7 @@ class PricingRule(Document):
|
||||
def validate_max_discount(self):
|
||||
if self.price_or_discount == "Discount Percentage" and self.item_code:
|
||||
max_discount = frappe.db.get_value("Item", self.item_code, "max_discount")
|
||||
if flt(self.discount_percentage) > max_discount:
|
||||
if max_discount and flt(self.discount_percentage) > flt(max_discount):
|
||||
throw(_("Max discount allowed for item: {0} is {1}%".format(self.item_code, max_discount)))
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user