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
This commit is contained in:
ruthra kumar
2022-06-30 15:14:38 +05:30
parent 9aea017990
commit 219855311d
2 changed files with 5 additions and 5 deletions

View File

@@ -162,7 +162,7 @@ class PaymentReconciliation(Document):
{ {
"reference_type": inv.voucher_type, "reference_type": inv.voucher_type,
"reference_name": inv.voucher_no, "reference_name": inv.voucher_no,
"amount": -(inv.outstanding), "amount": -(inv.outstanding_in_account_currency),
"posting_date": inv.posting_date, "posting_date": inv.posting_date,
"currency": inv.currency, "currency": inv.currency,
} }

View File

@@ -855,8 +855,8 @@ def get_outstanding_invoices(
) )
for d in invoice_list: for d in invoice_list:
payment_amount = d.invoice_amount - d.outstanding payment_amount = d.invoice_amount_in_account_currency - d.outstanding_in_account_currency
outstanding_amount = d.outstanding outstanding_amount = d.outstanding_in_account_currency
if outstanding_amount > 0.5 / (10**precision): if outstanding_amount > 0.5 / (10**precision):
if ( if (
min_outstanding min_outstanding
@@ -872,7 +872,7 @@ def get_outstanding_invoices(
"voucher_no": d.voucher_no, "voucher_no": d.voucher_no,
"voucher_type": d.voucher_type, "voucher_type": d.voucher_type,
"posting_date": d.posting_date, "posting_date": d.posting_date,
"invoice_amount": flt(d.invoice_amount), "invoice_amount": flt(d.invoice_amount_in_account_currency),
"payment_amount": payment_amount, "payment_amount": payment_amount,
"outstanding_amount": outstanding_amount, "outstanding_amount": outstanding_amount,
"due_date": d.due_date, "due_date": d.due_date,
@@ -1412,7 +1412,7 @@ def create_payment_ledger_entry(
if gle.against_voucher_type if gle.against_voucher_type
else gle.voucher_type, else gle.voucher_type,
"against_voucher_no": gle.against_voucher if gle.against_voucher else gle.voucher_no, "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": dr_or_cr,
"amount_in_account_currency": dr_or_cr_account_currency, "amount_in_account_currency": dr_or_cr_account_currency,
"delinked": True if cancel else False, "delinked": True if cancel else False,