From ae47fb9617c1cfd284ab0ce2bf6ab90e254899a4 Mon Sep 17 00:00:00 2001 From: Ninad1306 Date: Fri, 11 Oct 2024 11:33:27 +0530 Subject: [PATCH] fix: ignore free item when qty is zero (cherry picked from commit 7ae98f77eeee9b44d0afb9899c826a5acd4eb126) --- erpnext/accounts/doctype/pricing_rule/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/accounts/doctype/pricing_rule/utils.py b/erpnext/accounts/doctype/pricing_rule/utils.py index b5d4af1ab90..0032e539e44 100644 --- a/erpnext/accounts/doctype/pricing_rule/utils.py +++ b/erpnext/accounts/doctype/pricing_rule/utils.py @@ -644,6 +644,9 @@ def get_product_discount_rule(pricing_rule, item_details, args=None, doc=None): if pricing_rule.round_free_qty: qty = math.floor(qty) + if not qty: + return + free_item_data_args = { "item_code": free_item, "qty": qty,