[fix] currency moved to frappe

This commit is contained in:
Rushabh Mehta 2014-09-29 12:17:03 +05:30
parent 1c91868755
commit 66e08e39f7
2 changed files with 11 additions and 3 deletions

View File

@ -146,7 +146,6 @@ class AccountsController(TransactionBase):
self.currency = company_currency
self.conversion_rate = 1.0
else:
from erpnext.setup.doctype.currency.currency import validate_conversion_rate
validate_conversion_rate(self.currency, self.conversion_rate,
self.meta.get_label("conversion_rate"), self.company)
@ -500,3 +499,12 @@ def get_taxes_and_charges(master_doctype, master_name, tax_parentfield):
taxes_and_charges.append(tax)
return taxes_and_charges
def validate_conversion_rate(currency, conversion_rate, conversion_rate_label, company):
"""common validation for currency and price list currency"""
company_currency = frappe.db.get_value("Company", company, "default_currency")
if not conversion_rate:
throw(_("{0} is mandatory. Maybe Currency Exchange record is not created for {1} to {2}.").format(
conversion_rate_label, currency, company_currency))

View File

@ -8,6 +8,7 @@ from frappe.utils import flt, cint, add_days
import json
from erpnext.accounts.doctype.pricing_rule.pricing_rule import get_pricing_rule_for_item
from erpnext.setup.utils import get_exchange_rate
from frappe.model.meta import get_field_precision
@frappe.whitelist()
def get_item_details(args):
@ -206,8 +207,7 @@ def validate_price_list(args):
throw(_("Price List not selected"))
def validate_conversion_rate(args, meta):
from erpnext.setup.doctype.currency.currency import validate_conversion_rate
from frappe.model.meta import get_field_precision
from erpnext.controllers.accounts_controller import validate_conversion_rate
# validate currency conversion rate
validate_conversion_rate(args.currency, args.conversion_rate,