Using this script to grab batch status from the Quality Inspection doctype. Works great BUT I have to use alt-refresh on the browser to get the updated status when it changes. Any way to have this automatically refresh??
frappe.ui.form.on("Batch", {
onload:frappe.call({
method:"frappe.client.get_value",
async:true,
args:{
doctype:'Quality Inspection',
filters:{
batch_no:cur_frm.doc.batch_id
},
fieldname:['status']
},callback:function(r){
console.log(r.message);
if(r.message !== undefined){
cur_frm.set_value('status', r.message.status);
cur_frm.refresh_fields('status');
frm.refresh();
}
}
})
});