What is the python equvalent of frm.is_new()

I know that in JavaScript, we can check if a document is new by using frm.is_new() or frm.doc.docstatus. Is there a similar function in Python, like self.is_new()?
I would like to call a controller method specifically on insert and update. Unfortunately, there is no controller method available that runs only on save. The before_insert method is triggered during insert, but there’s no equivalent method available solely for updates. The save controller is called for both insert and update.

https://frappeframework.com/docs/user/en/basics/doctypes/controllers

have you tried on_update or on_change method?

1 Like

@thinkdigital
You can use on_update or self.is_new() will work.

1 Like

Thank you for your response.
The on_change gets called every change.


Ill try the self.is_new() or self.docstatus inside on_change as suggested by @Gubbu77

1 Like