Merge pull request #4228 from nabinhait/exchange_rate

[fix] account currency is not mandatory in get exchange rate
This commit is contained in:
Nabin Hait 2015-10-26 15:27:19 +05:30
commit 6d2d6862d6

View File

@ -817,11 +817,19 @@ def get_account_balance_and_party_type(account, date, company, debit=None, credi
return grid_values
@frappe.whitelist()
def get_exchange_rate(account, account_currency, company,
def get_exchange_rate(account, account_currency=None, company=None,
reference_type=None, reference_name=None, debit=None, credit=None, exchange_rate=None):
from erpnext.setup.utils import get_exchange_rate
account_details = frappe.db.get_value("Account", account,
["account_type", "root_type", "account_currency", "company"], as_dict=1)
if not company:
company = account_details.company
if not account_currency:
account_currency = account_details.account_currency
company_currency = get_company_currency(company)
account_details = frappe.db.get_value("Account", account, ["account_type", "root_type"], as_dict=1)
if account_currency != company_currency:
if reference_type in ("Sales Invoice", "Purchase Invoice") and reference_name: