From 926c0c5cf41545cfb2c367e4a489ec1c7296a364 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 15 May 2025 19:35:03 +0530 Subject: [PATCH] fix: POS Invoice can't use Loyalty Points when Global Rounded Total is Disabled (backport #47491) (#47564) fix: POS Invoice can't use Loyalty Points when Global Rounded Total is Disabled (#47491) (cherry picked from commit b541b536c3f71fbf8c27b38bba94341f8b4aefe8) Co-authored-by: Kitti U. @ Ecosoft --- erpnext/accounts/doctype/loyalty_program/loyalty_program.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/loyalty_program/loyalty_program.py b/erpnext/accounts/doctype/loyalty_program/loyalty_program.py index f3ad84bf6d3..1e844afc4b0 100644 --- a/erpnext/accounts/doctype/loyalty_program/loyalty_program.py +++ b/erpnext/accounts/doctype/loyalty_program/loyalty_program.py @@ -168,8 +168,9 @@ 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.rounded_total: - frappe.throw(_("You can't redeem Loyalty Points having more value than the Rounded Total.")) + total_amount = ref_doc.grand_total if ref_doc.is_rounded_total_disabled() else ref_doc.rounded_total + if loyalty_amount > total_amount: + frappe.throw(_("You can't redeem Loyalty Points having more value than the Total Amount.")) if not ref_doc.loyalty_amount and ref_doc.loyalty_amount != loyalty_amount: ref_doc.loyalty_amount = loyalty_amount