Try ERPNext Try Frappe Cloud Buy Support Partners Foundation

Extend existing DocTypes through custom apps

Whats the correct way to customize a doctype or form using a custom app?
My use case is as below:

I am trying to hide some fields from the Entry screen when the document loads and some tasks to perform while the document is validated. I have tried it but its not working. I am pasting my code of the the file and the function below.

doc_events = {
	"Sales Invoice": {
		"validate": "cdocs.customizations.customizations.set_terms(self, method)"

the fuction on the file

from __future__ import unicode_literals
import frappe
#from frappe.model.document import Document

def set_terms(self, method):

What fields of Sales Invoice are you hiding?

py (python files) are for the back-end. Meaning saving things to the database.

js (javascript files) are for the front end. Meaning how it would appear on the Web.

Trying to hide several unnecessary sections for example “Loyalty Points Redemption” from the entry screen.
I am actually trying to make the Sales Invoice very compact by hiding said fields for some multiple and specific use cases.
I have been doing so by customising the form but need to change my approach to make it more easy to apply the same stuff on the other side through a custom app.