I created custom link field: sales_person on Sales Invoice. On Sales Invoice Item, I created custom field: comm_rate. The same comm_rate is on Sales Person doctype.
I want to fetch comm_rate form sales person master when adding sales invoice item and calculate commission per item.
I use this custom script but doesn’t work…
frappe.ui.form.on("Sales Invoice Item", "imei_serial_no", function(frm, cdt, cdn) {
var d = locals[cdt][cdn];
cur_frm.add_fetch(doc.sales_person, 'comm_rate', 'comm_rate');
refresh_field("items");
});
Source link-field is sales_person under Sales Invoice parent. Tried this as well but didn’t work cur_frm.add_fetch('sales_person', 'comm_rate', 'comm_rate');
Many examples I see is working for parent table…Tried many combinations but still stuck. Appreciate anybody who can help what’s wrong here?
Thanks