Update to erpnext/public/js/controllers/transaction.js in order to enable it detect when the doctype for which exchange rate is to be determined is a Sales Order or Purchase order. If it is either, then use transaction_date instead of posting_date as the argument to get_exchange_rate method
This commit is contained in:
parent
1f64f9897c
commit
375a3c003d
@ -417,6 +417,16 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
},
|
||||
|
||||
currency: function() {
|
||||
/* cksgb 19/09/2016: We need to detect if this transaction is a PO/SO.
|
||||
If so, use transaction_date.
|
||||
If not, use posting_date as we assume that any other document type is an accounting document. */
|
||||
|
||||
if (this.frm.doc.doctype == "Purchase Order" || this.frm.doc.doctype == "Sales Order"){
|
||||
lookup_date = this.frm.doc.transaction_date;
|
||||
}else{
|
||||
lookup_date = this.frm.doc.posting_date;
|
||||
}
|
||||
|
||||
var me = this;
|
||||
this.set_dynamic_labels();
|
||||
|
||||
@ -424,7 +434,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.posting_date, this.frm.doc.currency, company_currency,
|
||||
this.get_exchange_rate(lookup_date, this.frm.doc.currency, company_currency,
|
||||
function(exchange_rate) {
|
||||
me.frm.set_value("conversion_rate", exchange_rate);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user