Enhancing the Payment System

I’ve been using ERPNext for about a month (for development only yet) and I’ve found it quite easy to modify and improve. The payment system in ERPNext is amazing, however, I’ve noticed a limitation in it which I’ve decided to work on and I need your help because it is highly integrated and it’s difficult to understand the repercussions of my modifications.

It’s VERY difficult to create an entry for returning payments (unallocated amount) to parties (for over payment or cancelled order with advance payment). I don’t there is any way to return a Payment Entry. So here are the problems:

  • Payment Entry Form:
    • Payment Entry cannot reference another payment entry
    • Does not load Journal Entry with negative balances and shows an error like “Cannot receive from Supplier without negative balance invoices” (there is a workaround but causes the A/R or A/P reports to show some incorrect values, explained below)
    • Client side automatic allocation breaks when dealing with negative values
  • Journal Entry Form:
    • Cannot reference a Payment Entry
    • There is a validation that prevents creating the reverse entry for a Bank Journal Entry saying that “For {0}, only credit accounts can be linked against another debit entry” or vice versa
    • Forcing that entry by removing that validation causes problems in the Payment Reconciliation Tool (explained below)
  • Accounts Payable/Receivable Report:
    • Shows the partially returned payments (returned using Payment Entry) as PDC/LC and therefore shows an incorrect value in the remaining balance because it subtracts the incorrect PDC/LC amount too
  • Payment Reconciliation Tool:
    • Does not consider the reverse Journal Entry referencing the original entry that decreases the “invoiced amount” of a JE, therefore, loads the incorrect allocateable amount and allows allocating that entry with more than it actually can and the reverse entry’s information about over-allocation is not shown anywhere.

Now I have some suggestions for the solutions and I would really appreciate feedback on them. First of all, cancelling and amending a payment/journal entry is not the solution since there needs to be a trail of the money. Please don’t suggest workarounds and help me devise the solution

  • Payment Entry:
    • Load negative balance invoices. Maybe modify erpnext.account.utils.get_outstanding_invoices() to take an argument to include negative balance vouchers too. This will include the Journal Entries and Payment Entries both.
    • Since Payment Entry have to reference other vouchers to update it’s allocated amount so it’s not straight forward. There are 2 ways I can think of to handle the Payment Entry to Payment Entry referene
      • On submitting a Payment Entry update the references on the other Payment Entry so that BOTH payment entries reference each other and therefore both Payment Entry’s amount get allocated to each other. This solutions feels like the obvious thing to do but feels unsafe because of the redundant and circular references.
      • OR Use another DocType to act as an invoice document for return payments that “absorbs” the payment entry’s amount. That DocType could be used exclusively for “Return Payment Entries” or it could just be a behind-the-scenes DocType. This solution feels safer, more explicit and avoids the circular references between the PEs.
  • Journal Entry:
    • Remove that validation that prevents creating a reverse bank entry journal entry. Please some one tell me what is that validation for?
    • I don’t think Journal Entry should be able to reference Payment Entry since Payment Entry’s unallocated amount isn’t calculated using the balance amount of GL Entries with voucher_no = PE right? I’m assuming it’s unallocated amount is calculated from the references table only. … So instead use the Payment or Return Payment Entry.
  • Accounts Payable/Receivable Report:
    • Modify accounts_receivable.get_pdc_details() so that it doesn’t include return payment entries
  • Payment Reconciliation Tool
    • Calculate outstanding balance of Journal Entry considering that other Journal Entries can reference it

Am I missing anything? Would I have to consider more modules that are involved in the invoicing/payment system? Has anyone else also encountered any of these issues? Is this enhancement needed by ERPNext???

1 Like

Follow progress at: Payment System Enchancements: Generalizing invoices and payments by SaiFi0102 · Pull Request #15362 · frappe/erpnext · GitHub

1 Like

Any updates on this?