How to add a column in child table which can show the total of other column?

Not working -

@Anjalijangid try this code frappe.ui.form.on(‘Quotation’, {
validate: function(frm) {
let row = locals[cdt][cdn];
row.total_cbm = row.cbm * row.qty;
frm.refresh_field(“items”);
}
})

image

@Anjalijangid remove default code and just paste my code

image

@Anjalijangid try this code frappe.ui.form.on(‘Quotation’, {
validate: function(frm,cdt,cdn) {
let row = locals[cdt][cdn];
row.total_cbm = row.cbm * row.qty;
frm.refresh_field(“items”);
}
})

image

@Anjalijangid remove quote with “” in frm.refresh_field("items’')

Now the codes are correct but its not working

its showing zero instead of 10X0.464

image

@Anjalijangid when your form is saved its working


Its saved, but not working
Also, CBM is not in currency format its just in numbers

@Anjalijangid change to total cbm to fieldtype float

you are making changes in the cbm field and in refresh field you have written items…??


:sweat_smile: :sweat_smile:

@Anjalijangid try this @Anjalijangid try this code frappe.ui.form.on(‘Quotation’, {
validate: function(frm,cdt,cdn) {
let row = locals[cdt][cdn];
row.custom_total_cbm = row.cbm * row.qty;
frm.refresh_field(“items”);
}
})
i take wrong fieldname total_cbm instead of custom_total_cbm

1 Like

instead of item use the field name of total cbm

Its working now, But cant not change decimal values
I need three values after decimal

image

@Anjalijangid go to field properties set precision 3

I have zero knowledge of coding. :no_mouth:

Done, still same issue