Delete a payment entry with "Deductions or Loss"

I have a payment entry which contain “Deductions or Loss”
I submitted this payment entry, then I want to delete it.

I try to cancel and delete it, but a error message show up
“Cannot delete or cancel because Payment Entry ACC-PAY-2022-00005-1 is linked with GL Entry ACC-GLE-2022-00040”

I can’t delete this GL entry, so I stuck.

Can someone help me to delete these payments, or the sales invoices which linked them can’t be balanced.
Even if I cancel all payment, the amount on “Deductions or Loss” still be included.

The enviroment as below:
ERPNext: v13.21.0 (HEAD)
ERPNext Support: v0.0.3 (HEAD)
Frappe Framework: v13.21.0 (HEAD)
and I use Erpnext on cloud(Managed Hosting)

1 Like

Looking for same solution

Hi. Just an idea, I did not check it. You would try cancel the Payment Entry with a Journal Entry type Contra Entry, using the involved accounts and see if this solve. Maybe you would need link the debtors account row with the original Sale Invoice at the Reference Type and Reference Name fields.
I hope it can works.