Muthu
1
Hi Guys ,
The below script works perfectly for a master , but does not work for a child table . Please help
frappe.ui.form.on("Heatbatch", "item_code", function(frm, cdt, cdn){
frappe.after_ajax(function() {
frappe.call({
"method": "frappe.client.get_value",
args: {
doctype: "Customer TDC",
fieldname: "data_172",
filters: {
part_number:["=", frm.doc.item_code]
}
},
callback: function (data) {
console.log(data);
cur_frm.set_value("d1", data.message.data_172);
}
})
});});
The item_code and d1 fields are inside the child table , while data_172 is in master .
Please guide me .
Thanks
Take a look at this code. Here Sales Invoice Timesheet is a child table of Sales Invoice.
1 Like
Muthu
3
Many thanks for the sample script @KanchanChauhan , here goes my code , but it is not working
frappe.ui.form.on('Heatiss', {
item_code: function(frm, cdt, cdn){
var d = locals[cdt][cdn];
if(d.item_code) {
frappe.call({
method: "material_master.material_master.doctype.customer_tdc.customer_tdc.get_data_172",
args: {
'part_number': d.item_code
},
callback: function(r, rt) {
if(r.message){
data = r.message;
frappe.model.set_value(cdt, cdn, "d1", data.data_172);
}
}
});
}
}
});
No errors in the console but the script is not working , please help .
Thanks
Muthu
4
Hi @KanchanChauhan . Finally got it working with the below code ,
frappe.ui.form.on("heatiss", "item_code", function(frm, cdt, cdn){
frappe.after_ajax(function() {
var d = locals[cdt][cdn];
frappe.call({
"method": "frappe.client.get_value",
args: {
doctype: "Customer TDC",
fieldname: "data_172",
filters: {
part_number:["=", d.item_code]
}
},
callback: function (data) {
console.log(data);
frappe.model.set_value(cdt, cdn, "d1", data.message.data_172);
}
})
});
});
Thank you all for the help .