I added a custom field in Doctype “Sales Invoice” names “custom_advance_paid”.
Read Only = 1,
Allow on Submit = 1
And here is my Client Script to update that custom field on changing value of the standard field “outstanding_amount”.
frappe.ui.form.on('Sales Invoice', {
outstanding_amount: function(frm) {
frm.doc.custom_advance_paid = frm.doc.grand_total - frm.doc.outstanding_amount;
}
})
field “outstanding_amount” is getting updated when payment entry for this sales invoice is submitted.
This client script is working fine in another submittable custom doctype, but not working for “Sales Invoice”.
any hint or suggestions ?