From 8d8027d4233f9181a34ee00b33ff15da2cae2da4 Mon Sep 17 00:00:00 2001 From: Sugesh393 Date: Tue, 26 Nov 2024 13:58:52 +0530 Subject: [PATCH] fix: set outstanding amount while creating payment request for invoices (cherry picked from commit 38e7d0a41e2a55ef98f2c6147c34b64708929854) --- erpnext/accounts/doctype/payment_request/payment_request.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py index ae974a8cf0e..aaae8204a9b 100644 --- a/erpnext/accounts/doctype/payment_request/payment_request.py +++ b/erpnext/accounts/doctype/payment_request/payment_request.py @@ -667,11 +667,9 @@ def get_amount(ref_doc, payment_account=None): elif dt in ["Sales Invoice", "Purchase Invoice"]: if not ref_doc.get("is_pos"): if ref_doc.party_account_currency == ref_doc.currency: - grand_total = flt(ref_doc.rounded_total or ref_doc.grand_total) + grand_total = flt(ref_doc.outstanding_amount) else: - grand_total = flt( - flt(ref_doc.base_rounded_total or ref_doc.base_grand_total) / ref_doc.conversion_rate - ) + grand_total = flt(flt(ref_doc.outstanding_amount) / ref_doc.conversion_rate) elif dt == "Sales Invoice": for pay in ref_doc.payments: if pay.type == "Phone" and pay.account == payment_account: