Math Operation on fields

here is the error from console:

Error: Script terminated by timeout at:
Qa@http://localhost:8001/assets/frappe/js/lib/jquery/jquery.min.js:3:19975
hide@http://localhost:8001/assets/frappe/js/lib/jquery/jquery.min.js:3:22460
n.fn[b]@http://localhost:8001/assets/frappe/js/lib/jquery/jquery.min.js:3:29290
toggle@http://localhost:8001/assets/frappe/js/lib/jquery/jquery.min.js:3:22529
n.fn[b]@http://localhost:8001/assets/frappe/js/lib/jquery/jquery.min.js:3:29290
refresh_input@http://localhost:8001/assets/js/desk.min.js?ver=1504667907.0:4480:21
refresh@http://localhost:8001/assets/js/desk.min.js?ver=1504667907.0:4279:115
_f.Frm.prototype.watch_model_updates/<@http://localhost:8001/assets/js/form.min.js?ver=1504667907.0:300:33
runner/<@http://localhost:8001/assets/js/desk.min.js?ver=1504667907.0:7114:21
each@http://localhost:8001/assets/frappe/js/lib/jquery/jquery.min.js:2:2859
runner@http://localhost:8001/assets/js/desk.min.js?ver=1504667907.0:7112:4
trigger/<@http://localhost:8001/assets/js/desk.min.js?ver=1504667907.0:7131:12
  jquery.min.js:3:19975
TypeError: data.message.search is not a function[Learn More]  desk.min.js:925:6

Do you know how to fix it?

I suppose that problem because when you change value in “total_need_to_pay”, script is trying to execute but you don’t have value in payment field and then receive the error

Yeah I think so. Because the current receipt already have the value. So the code can run.