From 670d9e5556e2e43ec861e4e0d4669076547392bb Mon Sep 17 00:00:00 2001 From: abdosaeed95 <118386543+abdosaeed95@users.noreply.github.com> Date: Mon, 14 Aug 2023 16:24:01 +0300 Subject: [PATCH] fix: validate loyalty_amount against rounded_total instead of grand_total (#36466) --- erpnext/accounts/doctype/loyalty_program/loyalty_program.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/loyalty_program/loyalty_program.py b/erpnext/accounts/doctype/loyalty_program/loyalty_program.py index a134f74663..4f58579a52 100644 --- a/erpnext/accounts/doctype/loyalty_program/loyalty_program.py +++ b/erpnext/accounts/doctype/loyalty_program/loyalty_program.py @@ -145,8 +145,8 @@ def validate_loyalty_points(ref_doc, points_to_redeem): loyalty_amount = flt(points_to_redeem * loyalty_program_details.conversion_factor) - if loyalty_amount > ref_doc.grand_total: - frappe.throw(_("You can't redeem Loyalty Points having more value than the Grand Total.")) + if loyalty_amount > ref_doc.rounded_total: + frappe.throw(_("You can't redeem Loyalty Points having more value than the Rounded Total.")) if not ref_doc.loyalty_amount and ref_doc.loyalty_amount != loyalty_amount: ref_doc.loyalty_amount = loyalty_amount