Call method when document is deleted

Hello i want to execute code when document is deleted (Not DocType) i know on_trash method is standard handler for this can anyone show small snippet how to write this method in controller.any help is appreciated.


Write on_trash method in your form’s py file.
Like this

@Sangram also we have to add this doctype name in file na?


if you write it in your form’s py file then no need to add it in
But if you writing method in some another py file then you must call it from hooks.
As following,

doc_events = {
	"Doctype Name": {
		"on_trash": "method_path"

@Sangram how you find it in docs there is no clear documentation as you mentioned. Your statement is more clear than documentation.