fix: wrong amount fetched in payment reconciliation tool
- fetch amount on account currency for outstanding invoices and
- unreconcilied dr/cr notes
- fix currency field name in payment ledger entry creation
diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
index 5b2b526..5ed34d3 100644
--- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
+++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
@@ -162,7 +162,7 @@
{
"reference_type": inv.voucher_type,
"reference_name": inv.voucher_no,
- "amount": -(inv.outstanding),
+ "amount": -(inv.outstanding_in_account_currency),
"posting_date": inv.posting_date,
"currency": inv.currency,
}
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index 8daff9d..6be8fd7 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -855,8 +855,8 @@
)
for d in invoice_list:
- payment_amount = d.invoice_amount - d.outstanding
- outstanding_amount = d.outstanding
+ payment_amount = d.invoice_amount_in_account_currency - d.outstanding_in_account_currency
+ outstanding_amount = d.outstanding_in_account_currency
if outstanding_amount > 0.5 / (10**precision):
if (
min_outstanding
@@ -872,7 +872,7 @@
"voucher_no": d.voucher_no,
"voucher_type": d.voucher_type,
"posting_date": d.posting_date,
- "invoice_amount": flt(d.invoice_amount),
+ "invoice_amount": flt(d.invoice_amount_in_account_currency),
"payment_amount": payment_amount,
"outstanding_amount": outstanding_amount,
"due_date": d.due_date,
@@ -1412,7 +1412,7 @@
if gle.against_voucher_type
else gle.voucher_type,
"against_voucher_no": gle.against_voucher if gle.against_voucher else gle.voucher_no,
- "currency": gle.currency,
+ "account_currency": gle.account_currency,
"amount": dr_or_cr,
"amount_in_account_currency": dr_or_cr_account_currency,
"delinked": True if cancel else False,