While posting payments against Sales Invoice or Purchase Invoice, after the Party Type and Party is selected for one Journal Entry row and pasting the payment
the previously paid invoice is still being retrieved in the Reference Name list for Sales Invoice or Purchase Invoice for the same Party Type and Party.
The previously paid or processed document would not be retreieved in this list previously. Is this some kind of unnecessary caching issue or is the issue related to delayed reconciliation posting?
That may create serious delays for some customers while posting their Journal Entries.
Hi, this could be due to invoice outstanding not being in sync with payment schedule table(if payment terms template is used with allocate based on payment terms).
I have raised a GitHub issue:
opened 09:12AM - 05 Aug 26 UTC
bug
### Information about bug
if an invoice uses a Payment Terms Template with alloβ¦ cate payment based on payment terms enabled, and that invoice is settled by anything other than a payment entry that directly references it, the invoiceβs payment schedule table never updates. Payment Entry then reads its outstanding figure from that stale table instead from actual invoice outstanding.
**Steps to reproduce**
Setup:
1. Create a Payment Terms Template "Net 30" - single term, 30 days, 100%, with Allocate Payment Based On Payment Terms checked.
2. Create and submit a Sales Invoice for a customer, grand total 10,000, using that template
Then run any one of the following against that invoice.
Case A: Journal Entry carrying the invoice reference
1. Journal Entry: Debit Cash 2,000, Credit Debtors 2,000 with the customer as Party. On the Debtors row set Reference Type = Sales Invoice, Reference Name = the invoice. Submit.
Case B: on-account Journal Entry, reconciled afterwards
1. Journal Entry: Debit Cash 2,000, Credit Debtors 2,000 with the customer as Party, no reference. Submit.
2. Payment Reconciliation β select the customer β Get Unreconciled Entries β allocate 2,000 to the invoice β Reconcile.
Case C: Payment Entry, reconciled afterwards
1. Payment Entry: Receive 2,000 from the customer, no references filled in. Submit.
2. Payment Reconciliation β allocate 2,000 to the invoice β Reconcile
Case C is included to show this is not specific to Journal Entries, any settlement routed through Payment Reconciliation behaves identically, including a plain Payment Entry. Credit Notes reconciled against an invoice appear to be affected the same way.
**Observe:**
1. Open the Sales Invoice. Outstanding Amount = 8,000 (correct). In the Payment Terms section, the Payment Schedule row still shows Outstanding = 10,000, Paid Amount = 0.
2. Create a new Payment Entry for the customer -> Get Outstanding Invoices -> the invoice is pulled showing 10,000 outstanding instead of 8,000.
**Expected**
The schedule totals the invoice outstanding after every settlement, regardless of which document performed it.
**Additional finding: disabling the setting is not a workaround:**
1. On our instance 4 invoices had drifted this way, because settlements were made outside Payment Entry.
2. As a stopgap I unchecked Allocate Payment Based On Payment Terms. Payment Entry now correctly pulls the outstanding from the ledger, so the immediate symptom is gone.
3. But the existing Payment Schedule rows still hold their old values, and they are now frozen entirely with the setting off, even an ordinary Payment Entry no longer updates them. So those invoices will drift further from the ledger with every subsequent payment, not just when reconciled.
4. This means there is no configuration in which the schedule is both kept up to date and not trusted. Either it is read and can be stale, or it is ignored and abandoned. Reposting the ledgers does not touch it either, so already-affected records cannot be corrected through the UI at all.
### Module
accounts
### Version
Frappe Framework Version
frappe: 16.29.0
erpnext: 16.30.0
hrms: 16.15.0
india_compliance: 16.8.1
insights: 3.12.3
offsite_backups: 0.0.1
### Installation method
docker
### Relevant log output / Stack trace / Full Error Message.
```shell
```
Is yours similar?