From 2148e7e32d65efabaa22a32a8a093b0eb2bc319e Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 21 Mar 2022 14:57:25 +0530 Subject: [PATCH] fix: Payment Request Amount calculation in case of multicurrency (#30254) (#30326) (cherry picked from commit 9abd22b4088b70ce23b80f91feab66c28cca6465) Co-authored-by: Nabin Hait --- erpnext/accounts/doctype/payment_request/payment_request.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py index 1a833a4008e..5cf534faba1 100644 --- a/erpnext/accounts/doctype/payment_request/payment_request.py +++ b/erpnext/accounts/doctype/payment_request/payment_request.py @@ -394,7 +394,10 @@ def get_amount(ref_doc, payment_account=None): """get amount based on doctype""" dt = ref_doc.doctype if dt in ["Sales Order", "Purchase Order"]: - grand_total = flt(ref_doc.grand_total) - flt(ref_doc.advance_paid) + if ref_doc.party_account_currency == ref_doc.currency: + grand_total = flt(ref_doc.grand_total) - flt(ref_doc.advance_paid) + else: + grand_total = flt(ref_doc.grand_total) - flt(ref_doc.advance_paid) / ref_doc.conversion_rate elif dt in ["Sales Invoice", "Purchase Invoice"]: if ref_doc.party_account_currency == ref_doc.currency: