Hi,
I am looking for a trigger which get fired before a file get attached to a doctype.
Like, I have already written the code to restrict the user to remove any document attached to the item master, if item is in Approved State. Similarly, I want to call it before a file get attached to an Item Master, it should also restrict the user to attach any new document, if the item master is in Approved State.
on_trash will be called before any document get removed/deleted. autoname will be called before File Doctype names any document (before saving it into the database)
So, in this case if you hook the File Doctype with these triggers then these triggers will always be called before the event like. on_trash will be called before any file/attachment/document get deleted and autoname will be called before any file/document get attached.