fix: set outstanding amount while creating payment request for invoices

(cherry picked from commit 38e7d0a41e)
This commit is contained in:
Sugesh393
2024-11-26 13:58:52 +05:30
committed by Mergify
parent 9a374ddbd4
commit 8d8027d423

View File

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