Please, can anyone show me how to connect the Tax table to a setup run by custom script? Here is the custom script provided by @ Balamurugan_Ravichan
frappe.ui.form.on("Your Child Table Name Here!", {
item_code: function (frm, cdt, cdn) {
var child = locals[cdt][cdn];
if (child.item_code) {
calculateGrandTotal(frm);
}
},
qty: function (frm, cdt, cdn) {
var d = locals[cdt][cdn];
frappe.model.set_value(cdt, cdn, "amount", d.qty * d.rate);
calculateGrandTotal(frm);
},
rate: function (frm, cdt, cdn) {
var d = locals[cdt][cdn];
frappe.model.set_value(cdt, cdn, "amount", d.qty * d.rate);
calculateGrandTotal(frm);
},
});
function calculateGrandTotal(frm) {
var grand_total = 0;
frm.doc.items.forEach(function (item) {
grand_total += item.amount;
});
frm.set_value("grand_total", grand_total);
}
Also, if the customer’s default currency is for example Euro, how can I make my DocType convert from the default Dollars to Euro?
Thank you in advance.