Guys, I need your help.
I have a custom doctype that can make calculation. The Doctype has certain field that mandatory.
Which “status”, “total_need_to_pay” and “payment” are mandatory.
The status has 2 options:
- Outstanding
- Full Paid
The situation is here:
I want to make “total_need_to_pay” must more than “payment” if status is “Outstanding”.
If user input “total_need_to_pay” == “payment”, msgprint(“total need to pay must more that payment”)
I was try by myself by writing the code but have an error.
`TypeError: cur_frm.viewers is undefined[Learn More]`
And my code is:
frappe.ui.form.on('Employee Receipt', {
validate: function(frm) {
if (frm.doc.status == "Outstanding") {
if (frm.doc.total_need_to_pay <= frm.doc.payment) {
msgprint("total need to pay must more than payment");
validate = false;
}
}
}
}
Can anyone check my code please. I am very new in coding