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

share the image of your doctype properties

Go to the customize form of your child table doctype and select that particular that field and find the field

find this field and select as per requirements

@Anjalijangid done

Not working, its still showing 6 only

image

@Anjalijangid row.custom_total_cbm = (row.cbm * row.qty).toFixed(3);

Where to add 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).toFixed(3);
frm.refresh_field(“items”);
}
})
i take wrong fieldname total_cbm instead of custom_total_cbm

2 Likes

image

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

try currency instead of float and add precision

Total CBM can not be in currency !!

image

@Anjalijangid frm.refresh_field(“items”)
Please dont copy this line write itself

frappe.ui.form.on("Quotation", {
validate: function(frm,cdt,cdn) {
let row = locals[cdt][cdn];
row.custom_total_cbm = (row.cbm * row.qty).toFixed(3);
frm.refresh_field("items");
}
})

please add this code in your client script

image

Copy and paste this script in direct client script box without any other place.

not working

what is the field type of cbm

I’m not sure why there are so many discussions on such a small topic, especially since this information is already available in “Frappe Forum.” I could have looked it up myself. There are 40+ discussions about a small client script, which is interesting :sweat_smile:

Please check your field name and set it in the script.

frappe.ui.form.on('Quotation', {
    validate: function(frm) {
        $.each(frm.doc.items || [], function(i, d) {
            frappe.model.set_value(d.doctype, d.name, 'custom_total_cbm', d.cbm * d.qty);
        });
    },
});

@Anjalijangid, Everyone here is new but they are also trying to learn, so you should be patient and try a little yourself :grinning: