[Fix] User able to change discount if pricing rule has discount value as zero (#15921)
diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
index eca4320..75db8b9 100644
--- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
+++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
@@ -185,7 +185,8 @@
"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)