Hi,
This is quite strange. I have a custom script that works on Mozilla Firefox but is not working on Google Chrome or Microsoft Internet Explorer. My custom script is on Sales invoice for calculating the excise amount and vat amount separately from the sales taxes and charges table and save it on the file.
frappe.ui.form.on(“Sales Invoice”, {
validate: function(frm) {
frappe.model.set_value(frm.doc.doctype, frm.doc.name, "date_and_time_of_removal_of_goods", frm.doc.posting_date + " " + frm.doc.posting_time);
refresh_field("date_time_of_removal_of_goods");
frappe.model.set_value(frm.doc.doctype, frm.doc.name, "date_and_time_of_preparation_of_invoice", frm.doc.posting_date + " " + frm.doc.posting_time);
refresh_field("date_time_of_invoice");
// calculate excise amount
total_excise_amount = 0
total_vat_amount = 0
if(frm.doc.taxes) {
$.each(frm.doc.taxes, function(i, d) {
var excise_amount = 0;
var vat_amount = 0;
var tax_desc = d.description;
if (tax_desc.contains("Excise")) {
excise_amount = d.tax_amount;
total_excise_amount += flt(d.tax_amount)
} else {
}
if (tax_desc.contains("VAT")) {
vat_amount = d.tax_amount;
total_vat_amount += flt(d.tax_amount)
} else {
}
});
}
frappe.model.set_value(frm.doc.doctype, frm.doc.name, "excise_amount", total_excise_amount);
frappe.model.set_value(frm.doc.doctype, frm.doc.name, "vat_amount", total_vat_amount);
}
});
Once the sales invoice is opened and saved, it is not getting saved and is getting stuck up at that point in Chrome, whereas it is getting saved in Firefox and is also reflecting the values. What could be wrong? Is there something wrong in my custom script? Or, should there be something else that I should be looking at?
Thanks
Uma