Calculate Total Qty of items table of Sales Invoice

frappe.ui.form.on("Sales Invoice", {
	validate: function(frm) {
		total_qty = 0;
		$.each(frm.doc.items || [], function(i, d) {
			total_qty += flt(d.qty);
		});
		frm.set_value("net_weight", total_qty);
	}
});
2 Likes