From a88eaa6e206c21b9f5fd1cc6abbc1085e97e2269 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Thu, 8 Nov 2018 13:05:08 +0530 Subject: [PATCH] [Fix] User able to change discount if pricing rule has discount value as zero (#15921) --- erpnext/accounts/doctype/pricing_rule/pricing_rule.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py index eca4320e18..75db8b9314 100644 --- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py @@ -185,7 +185,8 @@ def get_pricing_rule_for_item(args): "discount_percentage": 0.0 }) else: - item_details.discount_percentage = pricing_rule.discount_percentage or args.discount_percentage + item_details.discount_percentage = (pricing_rule.get('discount_percentage', 0) + if pricing_rule else args.discount_percentage) elif args.get('pricing_rule'): item_details = remove_pricing_rule_for_item(args.get("pricing_rule"), item_details)