frappe.ui.form.on("NG 05 Book Payment Prod", {
refresh(frm) {
},
on_submit: function(frm) {
if (frm.doc.invoice_number_book) {
// Update the status of the related NG 03 Vendor Database Prod to "Paid"
frappe.call({
method: 'frappe.client.get',
args: {
doctype: 'NG 03 Vendor Database Prod',
filters: {
vendor_invoice_number: frm.doc.invoice_number_book
}
},
callback: function(response) {
if (response.message) {
let vendor = response.message
if (vendor.vendor_invoice_number.trim() === frm.doc.invoice_number_book.trim() && vendor.vendor_status === "Approved For Payment") {
frappe.db.set_value('NG 03 Vendor Database Prod',vendor.name,'status','Paid').then(r =>{
if (r.message) {
frappe.set_route('Form','NG 03 Vendor Database Prod',vendor.name)
}
})
}
else{
frappe.msgprint(__('Unable to fetch the NG 03 Vendor Database Prod document.'));
}
}
}
})
} else {
frappe.msgprint(__('No related NG 03 Vendor Database Prod document found.'));
}
}
});
why status field is not updated of NG 03 doctype