Naming series for core doctype like task

We can add naming series by overriding autonomy in custom app.

Is there any alternate method to add naming series using customise form?
I have tried it, but it didn’t worked?

sample code for those, who want to override autonomy from custom app.

custom methods.py

@frappe.whitelist()
def set_task_autoname(doc, method):
	project_abbr = frappe.db.get_value("Project",doc.project,"abbr")
	if project_abbr:
		doc.name =make_autoname("TASK-"+project_abbr + '-.#####')
	else:
		doc.name = make_autoname("TASK" + '.#####')

hooks.py

doc_events = {
	"Task": {
		"autoname": "dpioffice.custom_methods.set_task_autoname"
	},
}

Try it in validate