diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index a589a69..75322ce 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -20,7 +20,7 @@
 
 	if not party:
 		return {}
-		
+
 	if not frappe.db.exists(party_type, party):
 		frappe.throw(_("{0}: {1} does not exists").format(party_type, party))
 
@@ -29,7 +29,7 @@
 
 def _get_party_details(party=None, account=None, party_type="Customer", company=None,
 	posting_date=None, price_list=None, currency=None, doctype=None, ignore_permissions=False):
-	
+
 	out = frappe._dict(set_account_and_due_date(party, account, party_type, company, posting_date, doctype))
 
 	party = out[party_type.lower()]
@@ -145,20 +145,11 @@
 		"due_date": get_due_date(posting_date, party_type, party, company)
 	}
 	return out
-	
+
 def validate_accounting_currency(party):
-	company_currency = get_company_currency()
-	
-	# set party account currency
-	if not party.party_account_currency:
-		if party.default_currency:
-			party.party_account_currency = party.default_currency
-		elif len(set(company_currency.values())) == 1:
-				party.party_account_currency = company_currency.values()[0]
-			
 	party_account_currency_in_db = frappe.db.get_value(party.doctype, party.name, "party_account_currency")
 	if party_account_currency_in_db != party.party_account_currency:
-		existing_gle = frappe.db.get_value("GL Entry", {"party_type": party.doctype, 
+		existing_gle = frappe.db.get_value("GL Entry", {"party_type": party.doctype,
 			"party": party.name}, ["name", "account_currency"], as_dict=1)
 		if existing_gle:
 			if party_account_currency_in_db:
@@ -166,8 +157,8 @@
 					.format(party.doctype), InvalidCurrency)
 			else:
 				party.party_account_currency = existing_gle.account_currency
-		
-		
+
+
 def validate_party_account(party):
 	company_currency = get_company_currency()
 	if party.party_account_currency:
@@ -175,31 +166,31 @@
 		for company, currency in company_currency.items():
 			if currency != party.party_account_currency:
 				companies_with_different_currency.append(company)
-				
+
 		for d in party.get("accounts"):
 			if d.company in companies_with_different_currency:
 				companies_with_different_currency.remove(d.company)
-			
+
 			selected_account_currency = frappe.db.get_value("Account", d.account, "account_currency")
 			if selected_account_currency != party.party_account_currency:
 				frappe.throw(_("Account {0} is invalid, account currency must be {1}")
 					.format(d.account, selected_account_currency), InvalidAccountCurrency)
-				
+
 		if companies_with_different_currency:
 			frappe.msgprint(_("Please mention Default {0} Account for the following companies, as accounting currency is different from company's default currency: {1}")
 				.format(
-					"Receivable" if party.doctype=="Customer" else "Payable", 
+					"Receivable" if party.doctype=="Customer" else "Payable",
 					"\n" + "\n".join(companies_with_different_currency)
 				)
 			)
-			
+
 def get_company_currency():
 	company_currency = frappe._dict()
 	for d in frappe.get_all("Company", fields=["name", "default_currency"]):
 		company_currency.setdefault(d.name, d.default_currency)
-		
+
 	return company_currency
-				
+
 @frappe.whitelist()
 def get_party_account(company, party, party_type):
 	"""Returns the account for the given `party`.
@@ -241,7 +232,7 @@
 			credit_days = get_credit_days(party_type, party, company)
 			if credit_days:
 				due_date = add_days(posting_date, credit_days)
-				
+
 	return due_date
 
 def get_credit_days(party_type, party, company):
@@ -249,21 +240,21 @@
 		if party_type == "Customer":
 			credit_days_based_on, credit_days, customer_group = \
 				frappe.db.get_value(party_type, party, ["credit_days_based_on", "credit_days", "customer_group"])
-			
+
 			if not credit_days_based_on:
 				credit_days_based_on, credit_days = \
 					frappe.db.get_value("Customer Group", customer_group, ["credit_days_based_on", "credit_days"]) \
 					or frappe.db.get_value("Company", company, ["credit_days_based_on", "credit_days"])
-				
+
 			return credit_days_based_on, credit_days
 		else:
 			credit_days, supplier_type = frappe.db.get_value(party_type, party, ["credit_days", "supplier_type"])
 			if not credit_days:
 				credit_days = frappe.db.get_value("Supplier Type", supplier_type, "credit_days") \
 					or frappe.db.get_value("Company", company, "credit_days")
-					
+
 			return credit_days
-			
+
 def validate_due_date(posting_date, due_date, party_type, party, company):
 	if getdate(due_date) < getdate(posting_date):
 		frappe.throw(_("Due Date cannot be before Posting Date"))
@@ -276,9 +267,9 @@
 					.format(date_diff(due_date, default_due_date)))
 			else:
 				frappe.throw(_("Due / Reference Date cannot be after {0}").format(formatdate(default_due_date)))
-				
+
 @frappe.whitelist()
-def set_taxes(party, party_type, posting_date, company, customer_group=None, supplier_type=None, 
+def set_taxes(party, party_type, posting_date, company, customer_group=None, supplier_type=None,
 	billing_address=None, shipping_address=None, use_for_shopping_cart=None):
 	from erpnext.accounts.doctype.tax_rule.tax_rule import get_tax_template, get_party_details
 	args = {
@@ -287,19 +278,19 @@
 		"supplier_type":	supplier_type,
 		"company":			company
 	}
-	
+
 	if billing_address or shipping_address:
 		args.update(get_party_details(party, party_type, {"billing_address": billing_address, \
 			"shipping_address": shipping_address }))
 	else:
 		args.update(get_party_details(party, party_type))
-	
+
 	if party_type=="Customer":
 		args.update({"tax_type": "Sales"})
 	else:
 		args.update({"tax_type": "Purchase"})
-		
+
 	if use_for_shopping_cart:
 		args.update({"use_for_shopping_cart": use_for_shopping_cart})
-		
-	return get_tax_template(posting_date, args)
\ No newline at end of file
+
+	return get_tax_template(posting_date, args)
