validate pricing rule discount with item max discount

This commit is contained in:
Nabin Hait 2014-06-20 19:07:44 +05:30 committed by Anand Doshi
parent afffd656f6
commit 1b1b3a8fd6

View File

@ -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)))