Changes to allow exchange rates on a specific day to be stored in Currency Exchange and to be pulled by the necessary transactions based on the posting date.

This commit is contained in:
Chude Osiegbu
2016-09-05 23:35:00 +01:00
parent b2b238323b
commit 7be3aa3158
5 changed files with 131 additions and 89 deletions

View File

@@ -424,7 +424,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
// Added `ignore_pricing_rule` to determine if document is loading after mapping from another doc
if(this.frm.doc.currency && this.frm.doc.currency !== company_currency
&& !this.frm.doc.ignore_pricing_rule) {
this.get_exchange_rate(this.frm.doc.currency, company_currency,
this.get_exchange_rate(this.frm.doc.posting_date, this.frm.doc.currency, company_currency,
function(exchange_rate) {
me.frm.set_value("conversion_rate", exchange_rate);
});
@@ -452,10 +452,11 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
}
},
get_exchange_rate: function(from_currency, to_currency, callback) {
get_exchange_rate: function(posting_date, from_currency, to_currency, callback) {
return frappe.call({
method: "erpnext.setup.utils.get_exchange_rate",
args: {
posting_date: posting_date,
from_currency: from_currency,
to_currency: to_currency
},