Hi! I’m trying to populate a child table using data located in “Timesheet” DocType and “Timesheet Detail” Doctype but I cannot find the way to merge two “frappe.call”. See the code below:
frappe.ui.form.on("Task", {
refresh: function(frm) {
cur_frm.clear_table("registro_de_horas_en_tareas");
frappe.call({
method: "frappe.client.get_list",
args: {
doctype: "Timesheet",
filters: {"task": frm.doc.name},
limit_page_length: 200,
order_by: "from_time asc",
fields:["employee_name"]
},
args: {
doctype: "Timesheet Detail",
parent: "Timesheet",
filters: {"task": frm.doc.name},
limit_page_length: 200,
order_by: "from_time asc",
fields:["parent", "activity_type", "from_time", "to_time", "hours", "detalle" ],
},
callback: function(r) {
$.each(r.message, function(index, value) {
var new_row = frappe.model.add_child(frm.doc, "Registro de horas en tareas", "registro_de_horas_en_tareas");
new_row.registro = value["parent"];
new_row.tipo_de_actividad = value["activity_type"];
new_row.inicio = value["from_time"];
new_row.fin = value["to_time"];
new_row.horas = value["hours"];
new_row.detalle = value["detalle"];
new_row.responsable_de_la_actividad = value["employee_name"]
});
refresh_field("registro_de_horas_en_tareas");
}
})
}
})
Now I have two “args” and only the last one is used to populate the child table. How can I solve this?