Customize py function from custome app

ERPNext V12. I have a custom app and i need that the function “self.update_claimed_amount_in_employee_advance()” won’t execute, is there a way to do so or to override completely the “on_submit” function?

You can override self.update_claimed_amount_in_employee_advance() if it’s a whitelisted method. Otherwise you can hook to on_submit doc event and negate/reverse the functionality of self.update_claimed_amount_in_employee_advance.

Since this event is on_submit and due the hierarchy of doc_events, you will need to hook into the before_submit event and do something like that

def on_before_submit(doc, handler=None):
    doc.update_claimed_amount_in_employee_advance = lambda *args, **kwargs: None
1 Like