Ajax server side script calling Error

Hi Below is the server side script called by Client side ajax script in ITEM.

Client Script:

cur_frm.cscript.custom_validate = function(doc) {
cur_frm.call({
method: “myvalidate”,
doc: cur_frm.doc,
callback: function® {
alert®;
}
});
}

Below is the server side python script.

Server Script
def myvalidate(self):
return “Hai”

The AttributeError is show in the page during Execution of code.
Error:

Server Error: Please check your server logs or contact tech support.
Traceback (innermost last):
File “/home/erpnext/frappe-bench/apps/frappe/frappe/app.py”, line 49, in application
response = frappe.handler.handle()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/handler.py”, line 66, in handle
execute_cmd(cmd)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/handler.py”, line 89, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 531, in call
return fn(*args, **newargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/handler.py”, line 19, in runserverobj
frappe.widgets.form.run_method.runserverobj(method, docs=docs, dt=dt, dn=dn, arg=arg, args=args)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/widgets/form/run_method.py”, line 33, in runserverobj
fnargs, varargs, varkw, defaults = inspect.getargspec(getattr(doc, method))
AttributeError: ‘Item’ object has no attribute 'myvalidate’

Please format your scripts so that they are readable. :frowning: