fix: validate loyalty_amount against rounded_total instead of grand_total (#36466)

This commit is contained in:
abdosaeed95 2023-08-14 16:24:01 +03:00 committed by GitHub
parent 843e77e72d
commit 670d9e5556
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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