Error on deleting object of doctype

Cannot delete or cancel because <Doctype> <name> is linked with Event EV00095 at Row: 1

Doctype was created by me

This is caused by a link. As the error message already states, your doctype is linked to the event EV00095 and therefore can not be deleted. solution: remove the link in the event, then you can delete the record…

What do you think, can I do it automatically? Is exist some function that can delete doctype with all links or function, that can delete all links?

Well, if your system is selfhostet and you’ve got a own app, then you can easly write a server side code that will do this for you

Have you got any examples of projects, that use similar decision(delete links before deleting doctypes)?

look at erpnext.accounts.utils → unlink_ref_doc_from_payment_entries for e.g.

1 Like

Thanks, the problem was solved much easier. In doctype class was function delete_events(). My bad. I think, that I can close this topic

1 Like

Perfect :slight_smile: