Set exchange rate on change of date for Journal/Payment Entry

This commit is contained in:
Nabin Hait 2016-12-08 16:06:47 +05:30
parent aa0d174d3d
commit 352d95344e
2 changed files with 14 additions and 2 deletions

View File

@ -35,6 +35,14 @@ frappe.ui.form.on("Journal Entry", {
multi_currency: function(frm) {
erpnext.journal_entry.toggle_fields_based_on_currency(frm);
},
posting_date: function(frm) {
if(!frm.doc.multi_currency) return;
$.each(frm.doc.accounts || [], function(i, row) {
erpnext.journal_entry.set_exchange_rate(frm, row.doctype, row.name);
})
}
})

View File

@ -327,7 +327,7 @@ frappe.ui.form.on('Payment Entry', {
frappe.call({
method: "erpnext.setup.utils.get_exchange_rate",
args: {
posting_date: frm.doc.posting_date,
transaction_date: frm.doc.posting_date,
from_currency: from_currency,
to_currency: to_currency
},
@ -337,6 +337,10 @@ frappe.ui.form.on('Payment Entry', {
})
},
posting_date: function(frm) {
frm.events.paid_from_account_currency(frm);
},
source_exchange_rate: function(frm) {
if (frm.doc.paid_amount) {
frm.set_value("base_paid_amount", flt(frm.doc.paid_amount) * flt(frm.doc.source_exchange_rate));