Merge branch 'model-cleanup' of github.com:frappe/erpnext into model-cleanup
diff --git a/erpnext/hr/doctype/deduction_type/test_records.json b/erpnext/hr/doctype/deduction_type/test_records.json
index 0637a08..25dab0f 100644
--- a/erpnext/hr/doctype/deduction_type/test_records.json
+++ b/erpnext/hr/doctype/deduction_type/test_records.json
@@ -1 +1,10 @@
-[]
\ No newline at end of file
+[
+	{
+			"doctype": "Deduction Type",
+			"deduction_name": "_Test Professional Tax"
+	},
+	{
+			"doctype": "Deduction Type",
+			"deduction_name": "_Test TDS"
+	}
+]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/earning_type/test_records.json b/erpnext/hr/doctype/earning_type/test_records.json
index 0637a08..659ab52 100644
--- a/erpnext/hr/doctype/earning_type/test_records.json
+++ b/erpnext/hr/doctype/earning_type/test_records.json
@@ -1 +1,12 @@
-[]
\ No newline at end of file
+[
+	{
+			"doctype": "Earning Type",
+			"earning_name": "_Test Basic Salary",
+			"taxable": "Yes"
+	},
+	{
+			"doctype": "Earning Type",
+			"earning_name": "_Test Allowance",
+			"taxable": "Yes"
+	}
+]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py
index e1bc1f9..5de3495 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.py
+++ b/erpnext/hr/doctype/leave_application/leave_application.py
@@ -17,8 +17,8 @@
 from frappe.model.controller import DocListController
 class LeaveApplication(DocListController):
 	def setup(self):
-		if frappe.db.exists(self.doctype, self.name):
-			self.previous_doc = frappe.get_doc(self.doctype, self.name)
+		if not getattr(self, "__islocal", None) and frappe.db.exists(self.doctype, self.name):
+			self.previous_doc = frappe.db.get_value(self.doctype, self.name, "*", as_dict=True)
 		else:
 			self.previous_doc = None
 		
diff --git a/erpnext/hr/doctype/salary_slip/test_salary_slip.py b/erpnext/hr/doctype/salary_slip/test_salary_slip.py
index ab59044..e8c978e 100644
--- a/erpnext/hr/doctype/salary_slip/test_salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/test_salary_slip.py
@@ -23,10 +23,10 @@
 		ss.insert()
 		self.assertEquals(ss.total_days_in_month, 31)
 		self.assertEquals(ss.payment_days, 30)
-		self.assertEquals(ss.doclist[1].e_modified_amount, 14516.13)
-		self.assertEquals(ss.doclist[2].e_modified_amount, 500)
-		self.assertEquals(ss.doclist[3].d_modified_amount, 100)
-		self.assertEquals(ss.doclist[4].d_modified_amount, 48.39)
+		self.assertEquals(ss.earning_details[0].e_modified_amount, 14516.13)
+		self.assertEquals(ss.earning_details[1].e_modified_amount, 500)
+		self.assertEquals(ss.deduction_details[0].d_modified_amount, 100)
+		self.assertEquals(ss.deduction_details[1].d_modified_amount, 48.39)
 		self.assertEquals(ss.gross_pay, 15016.13)
 		self.assertEquals(ss.net_pay, 14867.74)
 		
@@ -35,10 +35,10 @@
 		ss.insert()
 		self.assertEquals(ss.total_days_in_month, 30)
 		self.assertEquals(ss.payment_days, 29)
-		self.assertEquals(ss.doclist[1].e_modified_amount, 14500)
-		self.assertEquals(ss.doclist[2].e_modified_amount, 500)
-		self.assertEquals(ss.doclist[3].d_modified_amount, 100)
-		self.assertEquals(ss.doclist[4].d_modified_amount, 48.33)
+		self.assertEquals(ss.earning_details[0].e_modified_amount, 14500)
+		self.assertEquals(ss.earning_details[1].e_modified_amount, 500)
+		self.assertEquals(ss.deduction_details[0].d_modified_amount, 100)
+		self.assertEquals(ss.deduction_details[1].d_modified_amount, 48.33)
 		self.assertEquals(ss.gross_pay, 15000)
 		self.assertEquals(ss.net_pay, 14851.67)