Hi All, I want to validate or refresh calculation in child table “Payment Entry Deduction” when I change the posting date in Payment Entry. This is my current script.
frappe.ui.form.on(‘Payment Entry Deduction’,{
amount: function(frm, cdt, cdn) {
var row = locals[cdt][cdn];
var company_currency = frappe.get_doc(":Company", frm.doc.company).default_currency;
if(row.is_unrealized_currency_translation == "1") {
frappe.model.set_value(cdt, cdn, "exchange_rate", 0);
frappe.model.set_value(cdt, cdn, "amount_in_account_currency", 0);
} else if(company_currency == frm.doc.paid_from_account_currency) {
frappe.model.set_value(cdt, cdn, "exchange_rate", 1);
frappe.model.set_value(cdt, cdn, "amount_in_account_currency", row.amount);
} else {
frappe.model.set_value(cdt, cdn, "exchange_rate", frm.doc.source_exchange_rate);
frappe.model.set_value(cdt, cdn, "amount_in_account_currency", flt(flt(row.amount) / flt(frm.doc.source_exchange_rate), -2));
}
}
});