Overriding a method which is not under any class,whitelist method

i need to override update_invoice_status in accounts_controller.py file . Here the problem is the method is not under class.and also not a whitelist method.how can I override the method?

The suggestion you would get from the community is to use monkey patch but I have tried that without success so far (I’m not a developer). You can search how to monkey patch and you’ll get several results. I hope you can succeed where I failed.

@flexy2ky yes I am looking at monkey patch. but I did not understand it well I do it in my custom app/init.py but it will work when the core file is called anywhere in the custom app it’s replaced by our overriding method.

but all I want is the method is call from hooks under daily events I need to override.