Best way to customize core functionnalities of ERPNext

I’d like to make customizations on some server side .py file like modifying Controller method of a doctype (Example modify Sales Invoice .py autoname method)

What is the best way to do this to keep these changes when updating to a new version of ERPNext ? Or is there no way of doing this ( changing code and keep it when updating to new version ). Is it possible with patches ? I saw a folder patches in ERPNext but couldn’t quite understand how to create custom patches.

You should create a custom app and use hooks to override the method. The docs should help you.


What about core functions of Frappe and ERPNext (not doctype related functions) can we use hooks to override them ?

I found that we can override whitelisted methods

What about non whitelisted methods ?

You could monkey patch the non-whitelisted methods from your hooks. Check out this thread.

1 Like

Great, I didn’t know about that monkey patching method. I’ll try it out. Thanks.