Hello,
So, I have a custom script the populates stock entry ‘default source warehouse’ and ‘default target warehouse’ from a linked field inside Employee
when using the add_fetch method from outside the if statement it works like a charm but when using it inside IF statement it doesn’t work although the print message method within the same condition works fine.
Here’s my code:
frappe.ui.form.on('Stock Entry',{
stock_entry_type : function(frm) {
//cur_frm.add_fetch('employee_id', 'default_warehouse', 'from_warehouse');
if (frm.doc.purpose == 'Material Transfer') {
// refresh_field("purpose");
msgprint('Message 1');
cur_frm.add_fetch('employee_id', 'default_warehouse', 'from_warehouse');
}
}
})