Combination validation from both custom script and doctype .py file?

Hi All,

Below is the validation code of custom script

Below is the validation code of doctype py file

Seem like only one part is working fine only.( need to remove other part )
How i convert the code below in custom script to .py file ?

// make a field read-only after saving
frappe.ui.form.on(“Task”, {
refresh: function(frm) {
// use the __islocal value of doc, to check if the doc is saved or not
frm.set_df_property(“myfield”, “read_only”, frm.doc.__islocal ? 0 : 1);
}
});

Custom Script should be like,

frappe.ui.form.on('Master God Plate', {
	refresh: function(frm) {
		//refresh block
	},

	validate: function(frm) {
		//validate block
	}
})