From 1b1b3a8fd65d7280399e30aa82ed29809379ef32 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 20 Jun 2014 19:07:44 +0530 Subject: [PATCH] validate pricing rule discount with item max discount --- erpnext/accounts/doctype/pricing_rule/pricing_rule.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py index c86e3f61e5..77b52b18f8 100644 --- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py @@ -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)))