Frappe Cloud Support Partners Foundation Frappe School

Delete Item error

I have removed all transactions from my company Technitrade. Now as I try to delete the item it give me an error “Cannot delete or cancel because Item DM001L is linked with Sales Invoice ACC-SINV-2021-00004” There is no Sales invoice ACC-SINV-2021-00004 in any records showing as i deleted them all. Please tell me what am I doing wrong here…

Sounds like the entry wasn’t deleted in the DB for some reason. You need to manually delete the entry in the DB to amend the fault.

Please tell me how to delete manually from DB?

From your console;

cd frappe-bench/

bench mariadb

SELECT * FROM tabSales Invoice;

Then send me the output

I am very new to all this. Thank you for guiding me here. Right now it is asking for enabling server script. I am trying to find this option.

You need to run those commands from the backend. So via your terminal, run those commands.

I dont have a terminal option here. ERPnext is setup on Frappe cloud.

I just did this. Is this how I can enable server script? if yes, now where next to use the following code you gave me…

cd frappe-bench/

bench mariadb

SELECT * FROM tabSales Invoice ;

Check with the Support team. They might help you on deleting the data on Server Side

Which support team? What am i doing wrong here?

In right side of your page you have support option ,Click that it will guide you.

You have to add "server_script_enabled": true in the site_config file.

Please refer to the documentation:

Facing the same issue here on Frappe Cloud.
@Khizar: Did you solve it (deleting entries via an SQL call on Frappe Cloud) and if yes, how?

Not yet. I gave up. So moving on. Just disabled the items that i dont want to use.

Too bad. That’s not really a solution. I’d like to stick with Frappe Cloud to support the Frappe team (and thus the maintenance of the project) but this is really a big downside.

There was a bug with the transaction deletion process which left child table data in the database causing these link validations to fail.

A patch for that is in the works, that will resolve your problem.

I highly recommend against running raw SQL against database yourself to fix this.

Thanks Ankush! Does the patch also fix prior broken deletions? (I already deleted several entries)

Yeah, it will fix previously deleted transactions hence called “patch”.

So I’d suggest ignoring this issue until next patch is released (mostly next version in ~15 days or a separate version release before that)


Perfect! That sounds great!