frappe/frappe#478 fixes
diff --git a/erpnext/accounts/doctype/pos_setting/pos_setting.py b/erpnext/accounts/doctype/pos_setting/pos_setting.py
index 65761c9..f7fdd31 100755
--- a/erpnext/accounts/doctype/pos_setting/pos_setting.py
+++ b/erpnext/accounts/doctype/pos_setting/pos_setting.py
@@ -8,7 +8,7 @@
 
 from frappe.model.document import Document
 
-class PosSetting(Document):
+class POSSetting(Document):
 	def get_series(self):
 		frappe.get_meta("Sales Invoice").get_field("naming_series").options or ""
 
diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
index 109d0e5..75a9ab5 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -4,7 +4,6 @@
 import frappe
 import unittest, json
 from frappe.utils import flt
-from frappe.model.doc import DocstatusTransitionError, TimestampMismatchError
 from erpnext.accounts.utils import get_stock_and_account_difference
 from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory
 
@@ -25,7 +24,7 @@
 		w.submit()
 		
 		w = frappe.get_doc(w2)
-		self.assertRaises(DocstatusTransitionError, w.submit)
+		self.assertRaises(frappe.DocstatusTransitionError, w.submit)
 		
 	def test_timestamp_change(self):
 		w = frappe.copy_doc(test_records[0])
@@ -40,7 +39,7 @@
 		
 		import time
 		time.sleep(1)
-		self.assertRaises(TimestampMismatchError, w2.save)
+		self.assertRaises(frappe.TimestampMismatchError, w2.save)
 		
 	def test_sales_invoice_calculation_base_currency(self):
 		si = frappe.copy_doc(test_records[2])
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index e7bb7c9..25bdfa9 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -35,7 +35,7 @@
 		validate_status(self.status, ["Draft", "Submitted", "Stopped", 
 			"Cancelled"])
 
-		pc_obj = frappe.get_doc(dt='Purchase Common')
+		pc_obj = frappe.get_doc('Purchase Common')
 		pc_obj.validate_for_items(self)
 		self.check_for_stopped_status(pc_obj)
 
diff --git a/erpnext/buying/doctype/supplier/supplier.py b/erpnext/buying/doctype/supplier/supplier.py
index 9179bc2..e48c0bf 100644
--- a/erpnext/buying/doctype/supplier/supplier.py
+++ b/erpnext/buying/doctype/supplier/supplier.py
@@ -16,7 +16,6 @@
 
 	def autoname(self):
 		supp_master_name = frappe.defaults.get_global_default('supp_master_name')
-		
 		if supp_master_name == 'Supplier Name':
 			if frappe.db.exists("Customer", self.supplier_name):
 				frappe.msgprint(_("A Customer exists with same name"), raise_exception=1)
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 0b1c001..24af1e3 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -210,7 +210,7 @@
 					"row_range": row_range
 				})
 		
-		if cint(tax.included_in_print_rate):
+		if cint(getattr(tax, "included_in_print_rate", None)):
 			if tax.charge_type == "Actual":
 				# inclusive tax cannot be of type Actual
 				throw((_("Row") 
@@ -259,7 +259,7 @@
 
 				tax.tax_amount_after_discount_amount += current_tax_amount
 				
-				if tax.category:
+				if getattr(tax, "category", None):
 					# if just for valuation, do not add the tax amount in total
 					# hence, setting it as 0 for further steps
 					current_tax_amount = 0.0 if (tax.category == "Valuation") \
diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py
index 6e03d47..3bde28b 100644
--- a/erpnext/controllers/buying_controller.py
+++ b/erpnext/controllers/buying_controller.py
@@ -50,7 +50,7 @@
 		from erpnext.stock.utils import validate_warehouse_company
 		
 		warehouses = list(set([d.warehouse for d in 
-			self.get(self.fname) if d.warehouse]))
+			self.get(self.fname) if getattr(d, "warehouse", None)]))
 				
 		for w in warehouses:
 			validate_warehouse_company(w, self.company)
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index 7dcc96e..aa96b7c 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -38,7 +38,7 @@
 	def on_update(self):
 		self.check_recursion()
 		self.update_exploded_items()
-		self.save()
+		self.db_update()
 	
 	def on_submit(self):
 		self.manage_default_bom()
diff --git a/erpnext/setup/install.py b/erpnext/setup/install.py
index 6f4669e..68bc6cd 100644
--- a/erpnext/setup/install.py
+++ b/erpnext/setup/install.py
@@ -137,7 +137,8 @@
 	doc.save()
 
 def set_single_defaults():
-	for dt in frappe.db.sql_list("""select name from `tabDocType` where issingle=1"""):
+	for dt in frappe.db.sql_list("""select name from `tabDocType` 
+		where issingle=1 and paent != 'Control Panel'"""):
 		default_values = frappe.db.sql("""select fieldname, `default` from `tabDocField`
 			where parent=%s""", dt)
 		if default_values:
diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py
index 5a5bb03..756f540 100644
--- a/erpnext/stock/doctype/material_request/material_request.py
+++ b/erpnext/stock/doctype/material_request/material_request.py
@@ -124,7 +124,7 @@
 
 	def on_cancel(self):
 		# Step 1:=> Get Purchase Common Obj
-		pc_obj = frappe.get_doc(dt='Purchase Common')
+		pc_obj = frappe.get_doc('Purchase Common')
 		
 		# Step 2:=> Check for stopped status
 		pc_obj.check_for_stopped_status(self.doctype, self.name)
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index 1ac5826..9a137a1 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -53,7 +53,7 @@
 		self.validate_uom_is_integer("stock_uom", "stock_qty")
 		self.validate_challan_no()
 
-		pc_obj = frappe.get_doc(dt='Purchase Common')
+		pc_obj = frappe.get_doc('Purchase Common')
 		pc_obj.validate_for_items(self)
 		self.check_for_stopped_status(pc_obj)
 
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 56ba780..cdfff04 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -721,7 +721,7 @@
 	ref = frappe._dict()
 	
 	# get ref_doc
-	if args["purpose"] in return_map:
+	if args.get("purpose") in return_map:
 		for fieldname, val in return_map[args["purpose"]].items():
 			if args.get(fieldname):
 				ref.fieldname = fieldname