We want to add some features on top to Erpnext.
What we like to do is to create a SUB SET of methods in a custom .py class that will be called when events raise (for specific docType); so:
Is possible to create many different hooks.py (one for each doctype), to not change the original one in the application root?
Is possible to call any class method, or it must be a CONTROLLER?
2.1 In case it must be a controller is possible to inherit the original controller just adding needed methods?
Can i save my classes in .py file in a completely different folder than “frappe” or “erpnext” under “apps” folder? Because we’d like to stay clean and to not change nothing from the original installation, so we are also sure that our changes will not be “removed” after a “bench update”
Eg.: As an example image that on event “before_save” for DocType “sales_order” we want to call our custom function (completely external to ERPNEXT to not change or fork original source code), so this new custom method will create a new, NOT CUSTOM, doctype (like a new sales_order with a specific sales_order_item); and also we want to keep ERPNEXT and FRAPPE installation up-to-date.
How do you think it?