fix: Update get_amount to return currency precision grand total

In case of multi-currency purchase invoice, we are getting the error "Total Payment Request amount cannot be greater than Purchase Invoice amount" because of rounding difference.

(cherry picked from commit 976abf7b3c)

# Conflicts:
#	erpnext/accounts/doctype/payment_request/payment_request.py
This commit is contained in:
Syed Mujeer Hashmi
2024-07-24 11:59:45 +05:30
committed by Mergify
parent ab2b2dc5d4
commit f960aac639

View File

@@ -16,7 +16,7 @@ from erpnext.accounts.doctype.payment_entry.payment_entry import (
)
from erpnext.accounts.doctype.subscription_plan.subscription_plan import get_plan_rate
from erpnext.accounts.party import get_party_account, get_party_bank_account
from erpnext.accounts.utils import get_account_currency
from erpnext.accounts.utils import get_account_currency, get_currency_precision
from erpnext.utilities import payment_app_import_guard
@@ -566,7 +566,14 @@ def get_amount(ref_doc, payment_account=None):
elif dt == "Fees":
grand_total = ref_doc.outstanding_amount
<<<<<<< HEAD
return grand_total
=======
if grand_total > 0:
return flt(grand_total, get_currency_precision())
else:
frappe.throw(_("Payment Entry is already created"))
>>>>>>> 976abf7b3c (fix: Update get_amount to return currency precision grand total)
def get_existing_payment_request_amount(ref_dt, ref_dn):