Hi,
I want to add a row dynamically to Job card child table time logs. I have given below script,
frappe.ui.form.on(“Job Card”, {
refresh: function(frm,doc,cdt,cdn) {
var fromtime = frappe.datetime.now_datetime();
var totime = frappe.datetime.now_datetime();
var child = frm.add_child(“time_logs”);
frappe.model.set_value(child.doctype, child.name, “completed_qty”, doc.for_quantity);
frappe.model.set_value(child.doctype, child.name, “from_time”, fromtime);
frappe.model.set_value(child.doctype, child.name, “to_time”, totime);
frm.refresh_field(“time_logs”);
}
});
Its getting added when i click on new job card, but when i click on save, the rows are getting added twice,
Not sure where its wrong, kindly help, i also need to copy for quantity field from parent to child table field completed qty.
Thanks in advance!