From 2eb70026ae9d7176d9114874bffdbeafd8317f02 Mon Sep 17 00:00:00 2001 From: venkat102 Date: Thu, 21 Nov 2024 18:27:15 +0530 Subject: [PATCH] fix: make free qty round on large transaction qty (cherry picked from commit f9b816538584810aeb0721296899f7bb19dc1dd0) --- erpnext/accounts/doctype/pricing_rule/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/pricing_rule/utils.py b/erpnext/accounts/doctype/pricing_rule/utils.py index 0b3117365c0..bec4d2407de 100644 --- a/erpnext/accounts/doctype/pricing_rule/utils.py +++ b/erpnext/accounts/doctype/pricing_rule/utils.py @@ -642,7 +642,7 @@ def get_product_discount_rule(pricing_rule, item_details, args=None, doc=None): if transaction_qty: qty = flt(transaction_qty) * qty / pricing_rule.recurse_for if pricing_rule.round_free_qty: - qty = math.floor(qty) + qty = (flt(transaction_qty) // pricing_rule.recurse_for) * (pricing_rule.free_qty or 1) if not qty: return