How to perform calculation between feilds

Hi @Dharanipathi,

Please check it.

frappe.ui.form.on('Parent DocType',  {
    validate: function(frm) {
        gt = 0;
        $.each(frm.doc.items,  function(i,  d) {
            gt += flt(d.amount);
        });
        frm.doc.grand_total = gt;
    } 
});

here,
Parent DocType = Main Doctype name (eg. Orders)
frm.doc.items = child table field name
d.amount = child table field name
frm.doc.grand_total = parent field name

Please set your field name according.

Thank You!

4 Likes