Hi,
I have a use case where I want to have a link field to another doctype. If the Link doctype doesn’t exist, user can obviously create it by using Create New option in the form.
However I want to create this doctype even on the server i.e. if link doctype doesn’t exist create it.
I tried to tap into before_insert event however I get a link validation error before the event is fired.
Turns out the link validation happens in the constructor of the Document class. I tried to have a constructor where i set self.flags.ignore_links to true and then call the super constructor.
This worked in low traffic scenario, however I started getting quite a few Database Lock errors in my error log for some reason. The stack trace of the errors lead to my constructor in many a cases so I decided to comment that out.
Is there any way in frappe world to get an event before the link validation takes place ? so that I can create the link item.