From f960aac639a7ed2168b453d6b6b93975c15dc2fb Mon Sep 17 00:00:00 2001 From: Syed Mujeer Hashmi Date: Wed, 24 Jul 2024 11:59:45 +0530 Subject: [PATCH 1/2] 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 976abf7b3c92cd6387275442f87c784d4adf16e1) # Conflicts: # erpnext/accounts/doctype/payment_request/payment_request.py --- .../accounts/doctype/payment_request/payment_request.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py index adef60e58a7..8da6f153113 100644 --- a/erpnext/accounts/doctype/payment_request/payment_request.py +++ b/erpnext/accounts/doctype/payment_request/payment_request.py @@ -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): From 6310497403dcbbbfc4d25e84c090779db899fe9b Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 27 Aug 2024 17:11:10 +0530 Subject: [PATCH 2/2] chore: resolve conflict --- erpnext/accounts/doctype/payment_request/payment_request.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py index 8da6f153113..862f2dc0452 100644 --- a/erpnext/accounts/doctype/payment_request/payment_request.py +++ b/erpnext/accounts/doctype/payment_request/payment_request.py @@ -566,14 +566,10 @@ 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):