Pass buying or selling as filter parameters

Wherever get_exchange_rate is called, pass filter buying or selling on the basis of doctype.
This commit is contained in:
Shreya
2018-05-15 16:59:20 +05:30
parent b547cdd8fa
commit 3f77852e93
8 changed files with 27 additions and 12 deletions

View File

@@ -667,9 +667,14 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
},
get_exchange_rate: function(transaction_date, from_currency, to_currency, callback) {
if (this.frm.doctype == "Purchase Order") {
var args = "for_buying";
var args;
if (["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"].includes(this.frm.doctype)) {
args = "for_selling";
}
else if (["Purchase Order", "Purchase Receipt", "Purchase Invoice"].includes(this.frm.doctype)) {
args = "for_buying";
}
if (!transaction_date || !from_currency || !to_currency) return;
return frappe.call({
method: "erpnext.setup.utils.get_exchange_rate",