ERPNext Conference 2019* ERPNext.com Blog

Error on deleting object of doctype


#1

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

Doctype was created by me


#2

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…


#3

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?


#4

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


#5

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


#6

look at erpnext.accounts.utils --> unlink_ref_doc_from_payment_entries for e.g.


#7

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


#8

Perfect :slight_smile: