I think what you will have to do is write a ‘for’ loop to do this. I’ll work on this tomorrow, because it’s something I need as well. As for the link, I was just putting it there so that anyone coming across either thread sees the link.
Your value adding functions look correct.
frappe.ui.form.on("Denominaciones", {
"denominacion": function(frm, cdt, cdn) {
var d = locals[cdt][cdn];
frappe.model.set_value(d.doctype, d.name, "valor", d.denominacion * d.cantidad);
}
});
frappe.ui.form.on("Denominaciones", {
"cantidad": function(frm, cdt, cdn) {
var d = locals[cdt][cdn];
frappe.model.set_value(d.doctype, d.name, "valor", d.denominacion * d.cantidad);
}
});
frappe.ui.form.on("Denominaciones", {
"cantidad": function(frm, cdt, cdn) {
var d = locals[cdt][cdn];
var total = 0;
for (i = 0; i < [DONOTYETKNOW]; i++) {
total += d.valor;
}
frm.set_value('balance_real', total);
}
});
The part [DONOTYETKNOW] should be how many lines there are in the child table.
I’ll update this post as I look deeper into this.
Different possible solution (From a thread detailing my problem with the same thing, from a while back):