Error after reloading a document using after_save

Hi all,

I added a this script to reload the document after saving a Salary Slip document in the Custom Script function.

frappe.ui.form.on(‘Salary Slip’, ‘after_save’, function(frm) {
    frm.reload_doc();
});

However, I am getting and error which is as below.

image

Reloading manually does not trigger this error. Does anyone know why using that script will cause this ?

This is the traceback.

Traceback (most recent call last):
File “/home/myfiles/frappe-bench/apps/frappe/frappe/app.py”, line 64, in application
response = frappe.api.handle()
File “/home/myfiles/frappe-bench/apps/frappe/frappe/api.py”, line 58, in handle
return frappe.handler.handle()
File “/home/myfiles/frappe-bench/apps/frappe/frappe/handler.py”, line 30, in handle
data = execute_cmd(cmd)
File “/home/myfiles/frappe-bench/apps/frappe/frappe/handler.py”, line 70, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/myfiles/frappe-bench/apps/frappe/frappe/init.py”, line 1117, in call
return fn(*args, **newargs)
File “/home/myfiles/frappe-bench/apps/frappe/frappe/handler.py”, line 101, in runserverobj
frappe.desk.form.run_method.runserverobj(method, docs=docs, dt=dt, dn=dn, arg=arg, args=args)
File “/home/myfiles/frappe-bench/apps/frappe/frappe/desk/form/run_method.py”, line 21, in runserverobj
doc = frappe.get_doc(json.loads(docs))
File “/usr/lib/python3.6/json/init.py”, line 348, in loads
‘not {!r}’.format(s.class.name))
TypeError: the JSON object must be str, bytes or bytearray, not ‘NoneType’

Thanks.