[fix] Don't overwrite exchange rate on saving for bank transfer

This commit is contained in:
Nabin Hait 2015-12-01 18:59:34 +05:30
parent f1f556c0ac
commit 1c77506e80
2 changed files with 2 additions and 6 deletions

View File

@ -368,10 +368,6 @@ frappe.ui.form.on("Journal Entry Account", {
credit: function(frm, dt, dn) {
cur_frm.cscript.update_totals(frm.doc);
},
exchange_rate: function(frm, cdt, cdn) {
erpnext.journal_entry.set_debit_credit_in_company_currency(frm, cdt, cdn);
}
})
@ -418,7 +414,7 @@ $.extend(erpnext.journal_entry, {
if(row.account_currency == company_currency || !frm.doc.multi_currency) {
frappe.model.set_value(cdt, cdn, "exchange_rate", 1);
} else if (!row.exchange_rate || row.account_type == "Bank") {
} else if (!row.exchange_rate || row.exchange_rate == 1 || row.account_type == "Bank") {
frappe.call({
method: "erpnext.accounts.doctype.journal_entry.journal_entry.get_exchange_rate",
args: {

View File

@ -295,7 +295,7 @@ class JournalEntry(AccountsController):
for d in self.get("accounts"):
if d.account_currency == self.company_currency:
d.exchange_rate = 1
elif not d.exchange_rate or d.account_type=="Bank" or \
elif not d.exchange_rate or d.exchange_rate == 1 or \
(d.reference_type in ("Sales Invoice", "Purchase Invoice") and d.reference_name):
d.exchange_rate = get_exchange_rate(d.account, d.account_currency, self.company,
d.reference_type, d.reference_name, d.debit, d.credit, d.exchange_rate)