Loading…
Loading…
Pick what happens to a Sales Invoice. Click any event to see who runs there.
On a Sales Invoice, you…
Your customisation
validate
The same rule — a large invoice needs the customer’s PO number — written each way.
my_app/hooks.py
Runs after ERPNext’s own validate, in the same request and the same transaction.
Click a line with an amber dot to read what it does.
Never edit ERPNext’s files
An upgrade overwrites them. Put your code in your own Frappe app, in its own git repository.
Prefer hooks to overrides
doc_events and extend_doctype_class let several apps add code side by side. override_doctype_class lets only one win.
Use Server Scripts for small rules
Quick to write and change in the browser — but they live in the database, not in git, and must be switched on.
The server side is. ERPNext and the Frappe Framework under it are Python, with JavaScript in the browser and MariaDB for data. Each DocType has a Python controller class.
For a new document: before_insert, before_validate, validate, before_save, the database insert, after_insert, on_update and on_change. Submit swaps before_save for before_submit and adds on_submit after on_update.
It runs at validate, which comes before before_save — and it runs on submit too, because submit also calls validate. There is no Server Script event for before_save itself.
Server Scripts are off unless server_script_enabled is set in common_site_config.json, for example with bench set-config -g server_script_enabled 1.
Only if you must. override_doctype_class lets one app win; extend_doctype_class and doc_events let several apps add code side by side. Either way, keep it in your own app — never edit ERPNext’s files.
Our developers build custom Frappe apps — hooks, reports and integrations kept out of the core and in your own repository. Talk to a consultant.
or write to info@acube.co
Kochi (Kadavanthra & Infopark) · Thiruvananthapuram · across India & overseas · In business since 2011