Custom Function for Capitalise(UPPER CASE) the Data while saving

While saving, the input data of all data field must be saved as Capital Letters (Upper Case)

The custom python function for Capitalise/making UPPER CASE while saving a document is adding below : :relieved:


def validate(self) : 
     	zbn = frappe.get_meta(self.doctype)
		fieldnames =[x.fieldname for x in zbn.get("fields") if x.fieldtype in ["Data"]]
		if fieldnames:
			for fields in fieldnames:
				if self.get(fields):
					self.set(fields, str(self.get(fields)).upper())

Just Copy-Paste the same in your code. If the py file is in hooks, change “self” to “doc”.
Thank Me Later… :wink:

2 Likes