Cannot delete or cancel because Sales Invoice JMVW50/000007 is linked with GL Entry GL0308656

Hi, I am trying to delete the canceled sales invoice but it is showing me this error:-
Cannot delete or cancel because Sales Invoice [JMVW50/000007] is linked with GL Entry [GL0308656]

How can i delete the same?

Remove GL first

How to remove GL entry because there is no option to delete the GL entry.

You can not delete. only cancel is the option, there has multiple entries against single transaction.

But I want to delete the sales invoice due to this, our SI series is disturbing.
So, is there any option to delete the sales invoice or can we unlink the specific Sales invoice from GL entry?

All GL has referenced in Item Movement Transaction ie Receipt, Delivery. it show in Stock Ledger Report. Once it cancelled then Stock Leger filters out entry that has is_cancelled

Once All GL are cancelled then it (Sales Delivery, Purchase Receipt) will let you delete.


Thanks to solve the issue:)

Hi @Suresh_Thakor
Can you please explain this?
From what I understand, since v13 has immutable ledger, deleted GL entry is not possible and hence deleting Sales invoices is also not possible

Hi, @Manan_Shah

My ERPNext Version is as below.

ERPNext: v13.0.0-beta.14 (version-13-beta)
Frappe Framework: v13.0.0-beta.12 (version-13-beta)

There is an option to cancel at the Transaction (GL Entrly and Stock Ledger Entry). No option for Delete. When user insists to me to delete any PR or SD, I cancel all (GL Entrly and Stock Ledger Entry) that linked to releated Document then it lets me delete.
Still have’t migrated to V13.

If you cannot delete the GL Entry, can you still delete Sales Invoice?

Hi Mr. @Suresh_Thakor.

I was trying to create the fixed assets using the purchase cycle. For which I created the item and supplier. Then posted Material Request, Request for Quotation, Supplier Quotation, Purchase Order, Purchase Receipt, Purchase Invoice, and at last posted Payment Entry. Now we do not want to record this item as an asset, so I reversed the whole process and canclled all transactions I had created and all entries I had posted for this specific asset record.

I also canceled the four GL Entries recorded during the transaction. The problem is, ERPNext would not let me delete the “Purchase Payable” head I had created in "Chart of Accounts.

There is no transaction associated with this head, but still, it says “Account with existing transactions can not be deleted”.

I really would appreciate your help on this. Can you guide what is causing the issue? Note that this head was created when I was posting the asset record through the purchase cycle. It is not involved in any other transaction.

Thank You

This Account still linked with Cancelled GL Entry. you have to delete all cancelled entry from backend then it will let you delete.

Yes, thank you so much for your response, this is what I had thought too. But I do not know how to delete the GL Entries from the backend. Also, would they affect my instance in any case?

the data that needs to be deleted and it would be verified before delete it.
it will not affect the system. please take back up before executing any delete query.

Hi ,
I have the same problem, I created an Opening Sales Invoice entry to be posted on 31-12-2021, but it didn’t create all the invoices (due to exceeding the global Credit Limit setting).

So, I cancelled all the created Sales Invoices, and it’s related GL entries (Account Receivable and Temporary Account).

However, I still can not “Delete” the Sales Invoices as it said it is Linked with GL Entry. When I try to delete the GL Entry, the system recreates it automatically.

What am I missing ?


Option available in V13. Go to Account Setting and make enable Option.



It worked like a charm! Thanks @Suresh_Thakor

The Perfect Answer. :+1: