i have create one custom fields under delivery note item table (total rolls) and i would like to sum it under Delivery Note main doc custom field (Sum Total rolls). i have try to write the script below and no luck to make it works.
frappe.ui.form.on(“Delivery Note Item”, “total_rolls”, function(frm, cdt, cdn){
var d = locals[cdt][cdn];
frappe.model.set_value(d.doctype, d.name, “total_rolls”, d.total_rolls * 1);
var total = 0;
frm.doc.quotesection.forEach(function(d) { total += d.total_rolls; });
Thanks for your kind help.
it works. but the main doc total rolls will total vlaue become 200,200.0 if the table item got more than 1x item.
anyway to make it sum up the total rolls instead split by 200,200?
Thanks for your kind reply. your custom script work, but did not total up all the total rolls number.
Summary:
i) 1x custom field under delivery note item table (total rolls)
ii) 1x custom field under delivery note doc (total rolls)