Hooks on Child Table not working


I am trying to add hooks on Project User child table. I want to send mail to project user when the user is removed from the project.

Hence, I am trying to add hooks in the custom app on “on_trash” doc_event. But it is not working.

Also, I am adding same “on_trash” method in ProjectUser.py in erpnext/projects/doctype/project_user/project_user.py file. but it’s not working too.

Please help!!!

Thank you.

Events only works for parent doctypes.

You have to add hook on project doctype

Thanks for the reply saurabh.
but if I add a hook “on_update” of Project doctype, how would I get removed user so that I could send removal email to that user?

Do I have to use “before_insert” event?