Payment Entry: Updating the outstanding - possible bug?


ERPNext version is 10.1.11
When doing Payment Entry, I am noticing that the outstanding is giving the new outstanding after the payment done (which is the the outstanding before the payment - the allocated amount), but this only appears at user display (it is not stored in the database) because once I do refresh for the submitted payment, the outstanding is coming back to become the outstanding before doing the payment (which is given from the database).

Is this bug or it is designed to work like this?
If it is designed to work like this, can I know why? Because this will cause confuse when printing the Payment Entry (receipt) as it will display the updated outstanding, but this amount will differ when opening the payment next time as the refresh will fetch other outstanding amount from the database.


1 Like

Share some screen shots so that someone can understand and help.


As you can see in the below video, the outstanding balance is updated after submit and then it is returning to the previous balance after refreshing.

I was not able to place them in one video because of size (if someone knows a software that able to record in small size, I am fully thanks):

Saving Payment:


Submitting Payment:

Refreshing the document after submitting:


Hello @Pawan
Hopefully the screen shot is clear.
Is it bug or what?


I had the same problem today, and could over come it after finding out the reason which can be considered as a bug to be fixed. I use version 12.
Solution: When you create a payment entry, you have to do the following steps in order:

  1. add information except the allocation (the reference invoice)
  2. Save (don’t submit)
  3. Add the reference (invoice number and allocation amount)
  4. Submit
    If you do it by this order, the allocation will be saved, and the invoice will be connected to the payment.

I forgot that I had come up with a solution to this a while ago

Add a custom field to Payment Entry called Outstanding Amount

Then this client script:

//calculating a new outstanding amount as paid amount is entered. 
//The old outstanding amount is pulled from the Payment Entry References (child) table.
frappe.ui.form.on("Payment Entry",{
    validate: function(frm) {
        var outstanding = 0;    
        var tot_outstanding = 0;
        // add table's outstanding values
        $.each(frm.doc.references, function(index, row){
            tot_outstanding += row.outstanding_amount;
        outstanding = tot_outstanding - frm.doc.paid_amount; //subtract paid amount
        frm.set_value("outstanding_amount", outstanding);
1 Like


it works like a charm