frappe/frappe#478
diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py
index 18ae244..094edd0 100644
--- a/erpnext/accounts/doctype/account/account.py
+++ b/erpnext/accounts/doctype/account/account.py
@@ -3,12 +3,8 @@
 
 from __future__ import unicode_literals
 import frappe
-
 from frappe.utils import flt, fmt_money, cstr, cint
 from frappe import msgprint, throw, _
-
-get_value = frappe.db.get_value
-
 from frappe.model.document import Document
 
 class Account(Document):
@@ -19,10 +15,7 @@
 			frappe.db.get_value("Company", self.company, "abbr")
 
 	def get_address(self):
-		return {
-			'address': frappe.db.get_value(self.master_type, 
-				self.master_name, "address")
-		}
+		return {'address': frappe.db.get_value(self.master_type, self.master_name, "address")}
 		
 	def validate(self): 
 		self.validate_master_name()
@@ -32,24 +25,19 @@
 		self.validate_mandatory()
 		self.validate_warehouse_account()
 		self.validate_frozen_accounts_modifier()
-	
-		if not self.parent_account:
-			self.parent_account = ''
 		
 	def validate_master_name(self):
-		"""Remind to add master name"""
 		if self.master_type in ('Customer', 'Supplier') or self.account_type == "Warehouse":
 			if not self.master_name:
 				msgprint(_("Please enter Master Name once the account is created."))
-			elif not frappe.db.exists(self.master_type or self.account_type, 
-					self.master_name):
+			elif not frappe.db.exists(self.master_type or self.account_type, self.master_name):
 				throw(_("Invalid Master Name"))
 			
 	def validate_parent(self):
 		"""Fetch Parent Details and validation for account not to be created under ledger"""
 		if self.parent_account:
-			par = frappe.db.sql("""select name, group_or_ledger, report_type 
-				from tabAccount where name =%s""", self.parent_account, as_dict=1)
+			par = frappe.db.get_value("Account", self.parent_account, 
+				["name", "group_or_ledger", "report_type"], as_dict=1)
 			if not par:
 				throw(_("Parent account does not exists"))
 			elif par[0]["name"] == self.name:
@@ -63,14 +51,13 @@
 	def validate_duplicate_account(self):
 		if self.get('__islocal') or not self.name:
 			company_abbr = frappe.db.get_value("Company", self.company, "abbr")
-			if frappe.db.sql("""select name from tabAccount where name=%s""", 
-				(self.account_name + " - " + company_abbr)):
-					throw("{name}: {acc_name} {exist}, {rename}".format(**{
-						"name": _("Account Name"),
-						"acc_name": self.account_name,
-						"exist": _("already exists"),
-						"rename": _("please rename")
-					}))
+			if frappe.db.exists("Account", (self.account_name + " - " + company_abbr)):
+				throw("{name}: {acc_name} {exist}, {rename}".format(**{
+					"name": _("Account Name"),
+					"acc_name": self.account_name,
+					"exist": _("already exists"),
+					"rename": _("please rename")
+				}))
 				
 	def validate_root_details(self):
 		#does not exists parent
diff --git a/erpnext/accounts/doctype/account/test_account.py b/erpnext/accounts/doctype/account/test_account.py
index 10883d9..5cecab4 100644
--- a/erpnext/accounts/doctype/account/test_account.py
+++ b/erpnext/accounts/doctype/account/test_account.py
@@ -35,12 +35,12 @@
 	]
 
 	for company, abbr in [["_Test Company", "_TC"], ["_Test Company 1", "_TC1"]]:
-		test_objects = make_test_objects("Account", [[{
+		test_objects = make_test_objects("Account", [{
 				"doctype": "Account",
 				"account_name": account_name,
 				"parent_account": parent_account + " - " + abbr,
 				"company": company,
 				"group_or_ledger": group_or_ledger
-			}] for account_name, parent_account, group_or_ledger in accounts])
+			} for account_name, parent_account, group_or_ledger in accounts])
 	
 	return test_objects
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py
index 0559559..89d7c00 100644
--- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py
+++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py
@@ -7,18 +7,16 @@
 import frappe
 from frappe import _
 from frappe.utils import cint
-
 from frappe.model.document import Document
 
 class AccountsSettings(Document):
-
 	def on_update(self):
 		frappe.db.set_default("auto_accounting_for_stock", self.auto_accounting_for_stock)
 		
 		if cint(self.auto_accounting_for_stock):
 			# set default perpetual account in company
 			for company in frappe.db.sql("select name from tabCompany"):
-				frappe.bean("Company", company[0]).save()
+				frappe.get_doc("Company", company[0]).save()
 			
 			# Create account head for warehouses
 			warehouse_list = frappe.db.sql("select name, company from tabWarehouse", as_dict=1)
diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py
index d8edb20..dc7d57b 100644
--- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py
+++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py
@@ -3,20 +3,25 @@
 
 from __future__ import unicode_literals
 import frappe
-
-from frappe.utils import cstr, flt, getdate, now, nowdate
-from frappe import msgprint
-
+from frappe.utils import cstr, flt, getdate, nowdate
+from frappe import msgprint, _
 from frappe.model.document import Document
 
 class BankReconciliation(Document):
-
 	def get_details(self):
 		if not (self.bank_account and self.from_date and self.to_date):
 			msgprint("Bank Account, From Date and To Date are Mandatory")
 			return
 	
-		dl = frappe.db.sql("select t1.name, t1.cheque_no, t1.cheque_date, t2.debit, t2.credit, t1.posting_date, t2.against_account from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2 where t2.parent = t1.name and t2.account = %s and (clearance_date is null or clearance_date = '0000-00-00' or clearance_date = '') and t1.posting_date >= %s and t1.posting_date <= %s and t1.docstatus=1", (self.bank_account, self.from_date, self.to_date))
+		dl = frappe.db.sql("""select t1.name, t1.cheque_no, t1.cheque_date, t2.debit, 
+				t2.credit, t1.posting_date, t2.against_account 
+			from 
+				`tabJournal Voucher` t1, `tabJournal Voucher Detail` t2 
+			where 
+				t2.parent = t1.name and t2.account = %s 
+				and (clearance_date is null or clearance_date = '0000-00-00' or clearance_date = '') 
+				and t1.posting_date >= %s and t1.posting_date <= %s and t1.docstatus=1""", 
+				(self.bank_account, self.from_date, self.to_date))
 		
 		self.set('entries', [])
 		self.total_amount = 0.0
@@ -37,15 +42,14 @@
 		for d in self.get('entries'):
 			if d.clearance_date:
 				if d.cheque_date and getdate(d.clearance_date) < getdate(d.cheque_date):
-					msgprint("Clearance Date can not be before Cheque Date (Row #%s)" % 
-						d.idx, raise_exception=1)
+					frappe.throw("Clearance Date can not be before Cheque Date (Row #%s)" % d.idx)
 					
-				frappe.db.sql("""update `tabJournal Voucher` 
-					set clearance_date = %s, modified = %s where name=%s""",
-					(d.clearance_date, nowdate(), d.voucher_id))
+				frappe.db.set_value("Journal Voucher", d.voucher_id, "clearance_date", d.clearance_date)
+				frappe.db.sql("""update `tabJournal Voucher` set clearance_date = %s, modified = %s 
+					where name=%s""", (d.clearance_date, nowdate(), d.voucher_id))
 				vouchers.append(d.voucher_id)
 
 		if vouchers:
 			msgprint("Clearance Date updated in %s" % ", ".join(vouchers))
 		else:
-			msgprint("Clearance Date not mentioned")
\ No newline at end of file
+			msgprint(_("Clearance Date not mentioned"))
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.py b/erpnext/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.py
index 93dca1d..9be696c 100644
--- a/erpnext/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.py
+++ b/erpnext/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.py
@@ -3,7 +3,6 @@
 
 from __future__ import unicode_literals
 import frappe
-
 from frappe.model.document import Document
 
 class BankReconciliationDetail(Document):
diff --git a/erpnext/accounts/doctype/budget_detail/budget_detail.py b/erpnext/accounts/doctype/budget_detail/budget_detail.py
index 58106a0..ff4f886 100644
--- a/erpnext/accounts/doctype/budget_detail/budget_detail.py
+++ b/erpnext/accounts/doctype/budget_detail/budget_detail.py
@@ -3,7 +3,6 @@
 
 from __future__ import unicode_literals
 import frappe
-
 from frappe.model.document import Document
 
 class BudgetDetail(Document):
diff --git a/erpnext/accounts/doctype/budget_distribution/budget_distribution.py b/erpnext/accounts/doctype/budget_distribution/budget_distribution.py
index 069c4d3..2cc5015 100644
--- a/erpnext/accounts/doctype/budget_distribution/budget_distribution.py
+++ b/erpnext/accounts/doctype/budget_distribution/budget_distribution.py
@@ -3,11 +3,8 @@
 
 from __future__ import unicode_literals
 import frappe
-
 from frappe.utils import flt
-from frappe.model.bean import getlist
-from frappe import msgprint, _
-
+from frappe import _
 from frappe.model.document import Document
 
 class BudgetDistribution(Document):
@@ -17,13 +14,12 @@
 		idx =1
 		for m in month_list:
 			mnth = self.append('budget_distribution_details')
-			mnth.month = m or ''
+			mnth.month = m
 			mnth.idx = idx
 			idx += 1
 			
 	def validate(self):
-		total = sum([flt(d.percentage_allocation, 2) for d in self.doclist.get(
-			{"parentfield": "budget_distribution_details"})])
+		total = sum([flt(d.percentage_allocation) for d in self.get("budget_distribution_details")])
 			
 		if total != 100.0:
-			msgprint(_("Percentage Allocation should be equal to ") + "100%", raise_exception=1)
\ No newline at end of file
+			frappe.throw(_("Percentage Allocation should be equal to ") + "100%")
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/budget_distribution/test_budget_distribution.py b/erpnext/accounts/doctype/budget_distribution/test_budget_distribution.py
index 15b60db..57fc162 100644
--- a/erpnext/accounts/doctype/budget_distribution/test_budget_distribution.py
+++ b/erpnext/accounts/doctype/budget_distribution/test_budget_distribution.py
@@ -2,69 +2,48 @@
 # License: GNU General Public License v3. See license.txt
 
 test_records = [
-	[{
+	{
 		"doctype": "Budget Distribution",
 		"distribution_id": "_Test Distribution",
 		"fiscal_year": "_Test Fiscal Year 2013",
-	}, {
-		"doctype": "Budget Distribution Detail",
-		"parentfield": "budget_distribution_details",
-		"month": "January",
-		"percentage_allocation": "8"
-	}, {
-		"doctype": "Budget Distribution Detail",
-		"parentfield": "budget_distribution_details",
-		"month": "February",
-		"percentage_allocation": "8"
-	}, {
-		"doctype": "Budget Distribution Detail",
-		"parentfield": "budget_distribution_details",
-		"month": "March",
-		"percentage_allocation": "8"
-	}, {
-		"doctype": "Budget Distribution Detail",
-		"parentfield": "budget_distribution_details",
-		"month": "April",
-		"percentage_allocation": "8"
-	}, {
-		"doctype": "Budget Distribution Detail",
-		"parentfield": "budget_distribution_details",
-		"month": "May",
-		"percentage_allocation": "8"
-	}, {
-		"doctype": "Budget Distribution Detail",
-		"parentfield": "budget_distribution_details",
-		"month": "June",
-		"percentage_allocation": "8"
-	}, {
-		"doctype": "Budget Distribution Detail",
-		"parentfield": "budget_distribution_details",
-		"month": "July",
-		"percentage_allocation": "8"
-	}, {
-		"doctype": "Budget Distribution Detail",
-		"parentfield": "budget_distribution_details",
-		"month": "August",
-		"percentage_allocation": "8"
-	}, {
-		"doctype": "Budget Distribution Detail",
-		"parentfield": "budget_distribution_details",
-		"month": "September",
-		"percentage_allocation": "8"
-	}, {
-		"doctype": "Budget Distribution Detail",
-		"parentfield": "budget_distribution_details",
-		"month": "October",
-		"percentage_allocation": "8"
-	}, {
-		"doctype": "Budget Distribution Detail",
-		"parentfield": "budget_distribution_details",
-		"month": "November",
-		"percentage_allocation": "10"
-	}, {
-		"doctype": "Budget Distribution Detail",
-		"parentfield": "budget_distribution_details",
-		"month": "December",
-		"percentage_allocation": "10"
-	}]
+		"budget_distribution_details": [
+			{
+				"month": "January",
+				"percentage_allocation": "8"
+			}, {
+				"month": "February",
+				"percentage_allocation": "8"
+			}, {
+				"month": "March",
+				"percentage_allocation": "8"
+			}, {
+				"month": "April",
+				"percentage_allocation": "8"
+			}, {
+				"month": "May",
+				"percentage_allocation": "8"
+			}, {
+				"month": "June",
+				"percentage_allocation": "8"
+			}, {
+				"month": "July",
+				"percentage_allocation": "8"
+			}, {
+				"month": "August",
+				"percentage_allocation": "8"
+			}, {
+				"month": "September",
+				"percentage_allocation": "8"
+			}, {
+				"month": "October",
+				"percentage_allocation": "8"
+			}, {
+				"month": "November",
+				"percentage_allocation": "10"
+			}, {
+				"month": "December",
+				"percentage_allocation": "10"
+			}
+		]
+	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/budget_distribution_detail/budget_distribution_detail.py b/erpnext/accounts/doctype/budget_distribution_detail/budget_distribution_detail.py
index 84d8060..87d38fd 100644
--- a/erpnext/accounts/doctype/budget_distribution_detail/budget_distribution_detail.py
+++ b/erpnext/accounts/doctype/budget_distribution_detail/budget_distribution_detail.py
@@ -3,7 +3,6 @@
 
 from __future__ import unicode_literals
 import frappe
-
 from frappe.model.document import Document
 
 class BudgetDistributionDetail(Document):
diff --git a/erpnext/accounts/doctype/c_form/c_form.py b/erpnext/accounts/doctype/c_form/c_form.py
index d0df2e4..95e2e40 100644
--- a/erpnext/accounts/doctype/c_form/c_form.py
+++ b/erpnext/accounts/doctype/c_form/c_form.py
@@ -3,14 +3,11 @@
 
 from __future__ import unicode_literals
 import frappe
-from frappe.utils import flt, getdate
-from frappe.model.bean import getlist
-
+from frappe.utils import flt
+from frappe import _
 from frappe.model.document import Document
 
 class CForm(Document):
-
-
 	def validate(self):
 		"""Validate invoice that c-form is applicable 
 			and no other c-form is received for that"""
@@ -21,18 +18,17 @@
 					`tabSales Invoice` where name = %s and docstatus = 1""", d.invoice_no)
 				
 				if not inv:
-					frappe.msgprint("""Invoice: %s is not exists in the system or 
-						is not submitted, please check.""" % d.invoice_no, raise_exception=1)
+					frappe.throw("""Invoice: %s is not exists in the system or 
+						is not submitted, please check.""" % d.invoice_no)
 					
 				elif inv[0][0] != 'Yes':
-					frappe.msgprint("C-form is not applicable for Invoice: %s" % 
-						d.invoice_no, raise_exception=1)
+					frappe.throw("C-form is not applicable for Invoice: %s" % d.invoice_no)
 					
 				elif inv[0][1] and inv[0][1] != self.name:
-					frappe.msgprint("""Invoice %s is tagged in another C-form: %s.
+					frappe.throw("""Invoice %s is tagged in another C-form: %s.
 						If you want to change C-form no for this invoice,
 						please remove invoice no from the previous c-form and then try again""" % 
-						(d.invoice_no, inv[0][1]), raise_exception=1)
+						(d.invoice_no, inv[0][1]))
 
 	def on_update(self):
 		"""	Update C-Form No on invoices"""
@@ -43,22 +39,19 @@
 		
 	def before_cancel(self):
 		# remove cform reference
-		frappe.db.sql("""update `tabSales Invoice` set c_form_no=null
-			where c_form_no=%s""", self.name)
+		frappe.db.sql("""update `tabSales Invoice` set c_form_no=null where c_form_no=%s""", self.name)
 		
 	def set_cform_in_sales_invoices(self):
 		inv = [d.invoice_no for d in self.get('invoice_details')]
 		if inv:
-			frappe.db.sql("""update `tabSales Invoice` set c_form_no=%s, modified=%s 
-				where name in (%s)""" % ('%s', '%s', ', '.join(['%s'] * len(inv))), 
-				tuple([self.name, self.modified] + inv))
+			frappe.db.sql("""update `tabSales Invoice` set c_form_no=%s, modified=%s where name in (%s)""" % 
+				('%s', '%s', ', '.join(['%s'] * len(inv))), tuple([self.name, self.modified] + inv))
 				
 			frappe.db.sql("""update `tabSales Invoice` set c_form_no = null, modified = %s 
 				where name not in (%s) and ifnull(c_form_no, '') = %s""" % 
-				('%s', ', '.join(['%s']*len(inv)), '%s'),
-				tuple([self.modified] + inv + [self.name]))
+				('%s', ', '.join(['%s']*len(inv)), '%s'), tuple([self.modified] + inv + [self.name]))
 		else:
-			frappe.msgprint("Please enter atleast 1 invoice in the table", raise_exception=1)
+			frappe.throw(_("Please enter atleast 1 invoice in the table"))
 
 	def set_total_invoiced_amount(self):
 		total = sum([flt(d.grand_total) for d in self.get('invoice_details')])
@@ -67,13 +60,13 @@
 	def get_invoice_details(self, invoice_no):
 		"""	Pull details from invoices for referrence """
 
-		inv = frappe.db.sql("""select posting_date, territory, net_total, grand_total 
-			from `tabSales Invoice` where name = %s""", invoice_no)	
+		inv = frappe.db.get_value("Sales Invoice", invoice_no, 
+			["posting_date", "territory", "net_total", "grand_total"], as_dict=True)
 		return {
-			'invoice_date' : inv and getdate(inv[0][0]).strftime('%Y-%m-%d') or '',
-			'territory'    : inv and inv[0][1] or '',
-			'net_total'    : inv and flt(inv[0][2]) or '',
-			'grand_total'  : inv and flt(inv[0][3]) or ''
+			'invoice_date' : inv.posting_date,
+			'territory'    : inv.territory,
+			'net_total'    : inv.net_total,
+			'grand_total'  : inv.grand_total
 		}
 
 def get_invoice_nos(doctype, txt, searchfield, start, page_len, filters):
diff --git a/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.py b/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.py
index 8e3bc29..f6b5474 100644
--- a/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.py
+++ b/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.py
@@ -3,7 +3,6 @@
 
 from __future__ import unicode_literals
 import frappe
-
 from frappe.model.document import Document
 
 class CFormInvoiceDetail(Document):
diff --git a/erpnext/accounts/doctype/chart_of_accounts/chart_of_accounts.py b/erpnext/accounts/doctype/chart_of_accounts/chart_of_accounts.py
index 536b199..d6b9eeb 100644
--- a/erpnext/accounts/doctype/chart_of_accounts/chart_of_accounts.py
+++ b/erpnext/accounts/doctype/chart_of_accounts/chart_of_accounts.py
@@ -5,25 +5,21 @@
 import frappe, os, json
 from frappe.utils import cstr
 from unidecode import unidecode
-
-
 from frappe.model.document import Document
 
 class ChartOfAccounts(Document):
-		self.no_report_type = False
+	no_report_type = False
 		
 	def create_accounts(self, company):
 		chart = {}
-		with open(os.path.join(os.path.dirname(__file__), "charts", 
-			self.source_file), "r") as f:
+		with open(os.path.join(os.path.dirname(__file__), "charts", self.source_file), "r") as f:
 			chart = json.loads(f.read())
 			
-		from erpnext.accounts.doctype.chart_of_accounts.charts.account_properties \
-			import account_properties
+		from erpnext.accounts.doctype.chart_of_accounts.charts.account_properties import account_properties
 			
 		if chart:
 			accounts = []
-						
+			
 			def _import_accounts(children, parent):
 				for child in children:
 					account_name = child.get("name")
@@ -33,10 +29,9 @@
 						count = accounts.count(account_name_in_db)
 						account_name = account_name + " " + cstr(count)
 
-					child.update(account_properties.get(chart.get("name"), {})\
-						.get(account_name, {}))
+					child.update(account_properties.get(chart.get("name"), {}).get(account_name, {}))
 					
-					account = frappe.bean({
+					account = frappe.new_doc({
 						"doctype": "Account",
 						"account_name": account_name,
 						"company": company,
@@ -63,5 +58,5 @@
 			
 @frappe.whitelist()
 def get_charts_for_country(country):
-	return frappe.db.sql_list("select chart_name from `tabChart of Accounts` where country=%s", 
-		country)
\ No newline at end of file
+	return frappe.db.sql_list("""select chart_name from `tabChart of Accounts` 
+		where country=%s""", country)
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/chart_of_accounts/import_charts.py b/erpnext/accounts/doctype/chart_of_accounts/import_charts.py
index 1d34ab2..3806f08 100644
--- a/erpnext/accounts/doctype/chart_of_accounts/import_charts.py
+++ b/erpnext/accounts/doctype/chart_of_accounts/import_charts.py
@@ -13,7 +13,7 @@
 				chart = json.loads(f.read())
 				country = frappe.db.get_value("Country", {"code": fname.split("_", 1)[0]})
 				if country:
-					bean = frappe.bean({
+					bean = frappe.new_doc({
 						"doctype":"Chart of Accounts",
 						"chart_name": chart.get("name"),
 						"source_file": fname,
diff --git a/erpnext/accounts/doctype/cost_center/cost_center.py b/erpnext/accounts/doctype/cost_center/cost_center.py
index 79bd121..ac69e75 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center.py
+++ b/erpnext/accounts/doctype/cost_center/cost_center.py
@@ -3,19 +3,17 @@
 
 from __future__ import unicode_literals
 import frappe
-from frappe.model.bean import getlist
+
 from frappe import msgprint, _
 
 from frappe.utils.nestedset import DocTypeNestedSet
 
 class CostCenter(DocTypeNestedSet):
-
-		self.nsm_parent_field = 'parent_cost_center'
-				
+	nsm_parent_field = 'parent_cost_center'
+	
 	def autoname(self):
-		company_abbr = frappe.db.sql("select abbr from tabCompany where name=%s", 
-			self.company)[0][0]
-		self.name = self.cost_center_name.strip() + ' - ' + company_abbr
+		self.name = self.cost_center_name.strip() + ' - ' + \
+			frappe.get_value("Company", self.company, "abbr")
 		
 	def validate_mandatory(self):
 		if not self.group_or_ledger:
@@ -78,7 +76,7 @@
 		new_cost_center = get_name_with_abbr(newdn, self.company)
 		
 		# Validate properties before merging
-		super(DocType, self).before_rename(olddn, new_cost_center, merge, "group_or_ledger")
+		super(CostCenter, self).before_rename(olddn, new_cost_center, merge, "group_or_ledger")
 		
 		return new_cost_center
 		
@@ -87,5 +85,5 @@
 			frappe.db.set_value("Cost Center", newdn, "cost_center_name", 
 				" - ".join(newdn.split(" - ")[:-1]))
 		else:
-			super(DocType, self).after_rename(olddn, newdn, merge)
+			super(CostCenter, self).after_rename(olddn, newdn, merge)
 			
diff --git a/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py b/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py
index fb1508e..36b4e95 100644
--- a/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py
+++ b/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py
@@ -5,7 +5,7 @@
 import frappe
 
 from frappe.utils import flt
-from frappe.model.bean import getlist
+
 from frappe import msgprint, _
 
 from frappe.model.document import Document
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index f9e9481..eb8b93a 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -5,7 +5,7 @@
 import frappe
 
 from frappe.utils import cint, cstr, flt, formatdate
-from frappe.model.bean import getlist
+
 from frappe.model.code import get_obj
 from frappe import msgprint, _
 from erpnext.setup.utils import get_company_currency
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 449fca0..6413f91 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -10,7 +10,7 @@
 
 from frappe.utils import comma_and
 from frappe.model.naming import make_autoname
-from frappe.model.bean import getlist
+
 from frappe.model.code import get_obj
 from frappe import _, msgprint
 
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index 066afe0..bc6e17f 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -5,7 +5,7 @@
 import frappe
 
 from frappe.utils import cstr, flt
-from frappe.model.bean import getlist
+
 from frappe.model.code import get_obj
 from frappe import msgprint
 
diff --git a/erpnext/hr/doctype/appraisal/appraisal.py b/erpnext/hr/doctype/appraisal/appraisal.py
index b7b1421..1f7f255 100644
--- a/erpnext/hr/doctype/appraisal/appraisal.py
+++ b/erpnext/hr/doctype/appraisal/appraisal.py
@@ -5,7 +5,7 @@
 import frappe
 
 from frappe.utils import cstr, flt, getdate
-from frappe.model.bean import getlist
+
 from frappe import msgprint, _
 from frappe.model.mapper import get_mapped_doc
 from frappe.model.document import Document
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.py b/erpnext/hr/doctype/expense_claim/expense_claim.py
index 1d3697b..6a1be6e 100644
--- a/erpnext/hr/doctype/expense_claim/expense_claim.py
+++ b/erpnext/hr/doctype/expense_claim/expense_claim.py
@@ -4,7 +4,7 @@
 from __future__ import unicode_literals
 import frappe
 
-from frappe.model.bean import getlist
+
 from frappe import msgprint
 
 from frappe.model.document import Document
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py
index c81f22d..cfd39fc 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.py
@@ -6,7 +6,7 @@
 
 from frappe.utils import add_days, cint, cstr, flt, getdate, nowdate, _round
 from frappe.model.naming import make_autoname
-from frappe.model.bean import getlist
+
 from frappe.model.code import get_obj
 from frappe import msgprint, _
 from erpnext.setup.utils import get_company_currency
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index e3199f9..0799a60 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -4,7 +4,7 @@
 from __future__ import unicode_literals
 import frappe
 from frappe.utils import cint, cstr, flt, now, nowdate
-from frappe.model.bean import getlist
+
 from frappe.model.code import get_obj
 from frappe import msgprint, _
 
diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
index cdda05e..fa85eb1 100644
--- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
+++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
@@ -4,7 +4,7 @@
 from __future__ import unicode_literals
 import frappe
 from frappe.utils import cstr, flt, cint, nowdate, add_days
-from frappe.model.bean import getlist
+
 from frappe.model.code import get_obj
 from frappe import msgprint, _
 
diff --git a/erpnext/selling/doctype/installation_note/installation_note.py b/erpnext/selling/doctype/installation_note/installation_note.py
index db6d7ec..91f1a07 100644
--- a/erpnext/selling/doctype/installation_note/installation_note.py
+++ b/erpnext/selling/doctype/installation_note/installation_note.py
@@ -5,7 +5,7 @@
 import frappe
 
 from frappe.utils import cstr, getdate
-from frappe.model.bean import getlist
+
 from frappe import msgprint
 from erpnext.stock.utils import get_valid_serial_nos	
 
diff --git a/erpnext/selling/doctype/opportunity/opportunity.py b/erpnext/selling/doctype/opportunity/opportunity.py
index 8a103be..b9e873d 100644
--- a/erpnext/selling/doctype/opportunity/opportunity.py
+++ b/erpnext/selling/doctype/opportunity/opportunity.py
@@ -5,7 +5,7 @@
 import frappe
 
 from frappe.utils import cstr, cint
-from frappe.model.bean import getlist
+
 from frappe import msgprint, _
 
 	
diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py
index bcccdaa..2730dc5 100644
--- a/erpnext/selling/doctype/quotation/quotation.py
+++ b/erpnext/selling/doctype/quotation/quotation.py
@@ -4,7 +4,7 @@
 from __future__ import unicode_literals
 import frappe
 from frappe.utils import cstr
-from frappe.model.bean import getlist
+
 from frappe.model.code import get_obj
 from frappe import _, msgprint
 
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index ff235b1..679bffe 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -6,7 +6,7 @@
 import frappe.utils
 
 from frappe.utils import cstr, flt, getdate
-from frappe.model.bean import getlist
+
 from frappe.model.code import get_obj
 from frappe import msgprint
 from frappe.model.mapper import get_mapped_doc
diff --git a/erpnext/setup/doctype/authorization_control/authorization_control.py b/erpnext/setup/doctype/authorization_control/authorization_control.py
index 6e24859..a50eb2f 100644
--- a/erpnext/setup/doctype/authorization_control/authorization_control.py
+++ b/erpnext/setup/doctype/authorization_control/authorization_control.py
@@ -5,7 +5,7 @@
 import frappe
 
 from frappe.utils import cstr, flt, has_common, make_esc
-from frappe.model.bean import getlist
+
 from frappe import session, msgprint
 from erpnext.setup.utils import get_company_currency
 
diff --git a/erpnext/setup/doctype/sales_person/sales_person.py b/erpnext/setup/doctype/sales_person/sales_person.py
index 9139bab..db2057d 100644
--- a/erpnext/setup/doctype/sales_person/sales_person.py
+++ b/erpnext/setup/doctype/sales_person/sales_person.py
@@ -3,7 +3,7 @@
 
 from __future__ import unicode_literals
 import frappe
-from frappe.model.bean import getlist
+
 from frappe.utils import flt
 from frappe.utils.nestedset import DocTypeNestedSet
 
diff --git a/erpnext/setup/doctype/territory/territory.py b/erpnext/setup/doctype/territory/territory.py
index 67669d9..ed2d5f1 100644
--- a/erpnext/setup/doctype/territory/territory.py
+++ b/erpnext/setup/doctype/territory/territory.py
@@ -4,7 +4,7 @@
 from __future__ import unicode_literals
 import frappe
 
-from frappe.model.bean import getlist
+
 from frappe.utils import flt
 
 from frappe.utils.nestedset import DocTypeNestedSet
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index d48024f..100a599 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -5,7 +5,7 @@
 import frappe
 
 from frappe.utils import cstr, flt, cint
-from frappe.model.bean import getlist
+
 from frappe.model.code import get_obj
 from frappe import msgprint, _
 import frappe.defaults
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 9f556db..ea43b16 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -5,7 +5,7 @@
 import frappe
 
 from frappe.utils import cstr, flt, getdate, now_datetime, formatdate
-from frappe.model.bean import getlist
+
 from frappe import msgprint, _
 
 from frappe.model.controller import DocListController
diff --git a/erpnext/stock/doctype/packed_item/packed_item.py b/erpnext/stock/doctype/packed_item/packed_item.py
index 6c7ee51..232e601 100644
--- a/erpnext/stock/doctype/packed_item/packed_item.py
+++ b/erpnext/stock/doctype/packed_item/packed_item.py
@@ -6,7 +6,7 @@
 from __future__ import unicode_literals
 import frappe
 from frappe.utils import cstr, flt
-from frappe.model.bean import getlist
+
 
 from frappe.model.document import Document
 
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index 74c8cff..b1abf12 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -5,7 +5,7 @@
 import frappe
 
 from frappe.utils import cstr, flt, cint
-from frappe.model.bean import getlist
+
 from frappe.model.code import get_obj
 from frappe import msgprint, _
 import frappe.defaults
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index eeb8d82..25f3157 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -6,7 +6,7 @@
 import frappe.defaults
 
 from frappe.utils import cstr, cint, flt, comma_or, nowdate
-from frappe.model.bean import getlist
+
 from frappe.model.code import get_obj
 from frappe import msgprint, _
 from erpnext.stock.utils import get_incoming_rate
diff --git a/erpnext/stock/doctype/stock_ledger/stock_ledger.py b/erpnext/stock/doctype/stock_ledger/stock_ledger.py
index d0fe60a..615352f 100644
--- a/erpnext/stock/doctype/stock_ledger/stock_ledger.py
+++ b/erpnext/stock/doctype/stock_ledger/stock_ledger.py
@@ -5,7 +5,7 @@
 import frappe
 
 from frappe.utils import add_days, cstr, flt, nowdate, cint, now
-from frappe.model.bean import getlist
+
 from frappe.model.code import get_obj
 from frappe import session, msgprint
 from erpnext.stock.utils import get_valid_serial_nos
diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py
index 0052ab2..b3ed19c 100644
--- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py
+++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py
@@ -5,7 +5,7 @@
 import frappe
 
 from frappe.utils import add_days, cstr, getdate, cint
-from frappe.model.bean import getlist
+
 from frappe import throw, _
 from erpnext.utilities.transaction_base import TransactionBase, delete_events
 from erpnext.stock.utils import get_valid_serial_nos
diff --git a/erpnext/support/doctype/maintenance_visit/maintenance_visit.py b/erpnext/support/doctype/maintenance_visit/maintenance_visit.py
index f8eb96a..b11d656 100644
--- a/erpnext/support/doctype/maintenance_visit/maintenance_visit.py
+++ b/erpnext/support/doctype/maintenance_visit/maintenance_visit.py
@@ -5,7 +5,7 @@
 import frappe
 
 from frappe.utils import cstr
-from frappe.model.bean import getlist
+
 from frappe import msgprint
 
 	
diff --git a/erpnext/utilities/doctype/sms_control/sms_control.py b/erpnext/utilities/doctype/sms_control/sms_control.py
index 74b6e41..d16e54d 100644
--- a/erpnext/utilities/doctype/sms_control/sms_control.py
+++ b/erpnext/utilities/doctype/sms_control/sms_control.py
@@ -7,7 +7,7 @@
 from frappe.utils import nowdate, cstr
 from frappe.model.code import get_obj
 from frappe import msgprint, throw, _
-from frappe.model.bean import getlist
+
 
 from frappe.model.document import Document