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);
})
}
})
@ -345,7 +353,7 @@ frappe.ui.form.on("Journal Entry Account", {
});
}
},
debit_in_account_currency: function(frm, cdt, cdn) {
erpnext.journal_entry.set_exchange_rate(frm, cdt, cdn);
},

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
},
@ -336,6 +336,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) {