Post Unallocated Amount in payment entry to Advance Account
Description
When creating a Payment Entry directly from a Sales Invoice or Purchase Invoice, if the paid amount is greater than the invoice's outstanding amount, the excess amount becomes an Unallocated Amount.
Currently, this unallocated amount is also posted to the Customer/Supplier account along with the allocated amount.
Example
- Invoice Outstanding: 1,000
- Paid Amount: 1,500
- Allocated Amount: 1,000
- Unallocated Amount: 500
Currently, the full 1,500 is posted to the Customer/Supplier account.
Expected Behavior
The 1,000 allocated amount should be posted against the Customer/Supplier account, while the 500 unallocated amount should be posted to the Advance Account configured in the Company master.
The unallocated amount should be treated as a Customer/Supplier Advance rather than being posted to the Customer/Supplier account as part of the invoice settlement.
This should apply when creating Payment Entries directly from both Sales Invoices and Purchase Invoices.
Source: frappe/erpnext