I don't want to change core code files

Currently i do the core code changes like in Frappe or Erpnext core files.
Which is not right.
Example : i wanted to add a function get_leave_approver()

what i did was, i directly changed the core file (employee.py) file, which is wrong practice.
now how can i do this in custom app.
I think we need to use hooks.py file, but exactly how to do i don’t know
Anyone know how to do this??

Also like i did some changes in .js file (leave_application.js)

how can i do this change, in such a way that only below code runs in this validate functionality

I know i have to make a different js file in the custom app, also need to change the hooks.py file, but don’t know the exact process.

Hy @Rajat96318

Please You can see the override method in the hooks.

Override JS File

doctype_js = {"doctype" : "public/js/doctype.js"}

Override Whitelist Methods

override_whitelisted_methods = {
	"frappe.desk.doctype.event.event.get_events": "custom_module.event.get_events"
}

Thank You!