Method while deleting a doctype's item

Can anybody tell m which method is called when deleting an item from the doctype. Is it frappe.client.delete or something else ?

Hii nikz
on_trash() method in py, is called when you delete any document on doctype.
It is an py trigger which get called each time when you delete item on doctype.

1 Like

means frappe.client.ontrash ??

It should be like this, on your .py file:
class ClassName(Document):
def on_trash(self):
print(“-----------------on trash called-------------------”)

1 Like

but i don’t have access to back-end. Need to do it via custom script

I think your question is not about deleting a Document, but I guess Deleting an Item in the Document… which DocType you are working on?..

Are you talking about child table?

If you are talking about child table items then this code should help:


Hope this is what you are looking for… :slight_smile:


Parth Joshi

No I’m talking about deleting a document.

Ohh… thats a tough call… I looked into frappe triggers for the document… I could not find one for the delete…

It’s interesting, if it exists, its not talked about much.

If it does not exists, even then, I feel delete is sensitive one… should be handled at python…

Ok thanks