fix(test): multiple test cases fixed
diff --git a/erpnext/accounts/doctype/budget/test_budget.py b/erpnext/accounts/doctype/budget/test_budget.py
index 69c988a..b3d0dc1 100644
--- a/erpnext/accounts/doctype/budget/test_budget.py
+++ b/erpnext/accounts/doctype/budget/test_budget.py
@@ -18,7 +18,7 @@
 		budget = make_budget(budget_against="Cost Center")
 		
 		jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
-			"_Test Bank - _TC", 40000, "_Test Cost Center - _TC", submit=True)
+			"_Test Bank - _TC", 40000, "_Test Cost Center - _TC", posting_date="2013-02-28", submit=True)
 
 		self.assertTrue(frappe.db.get_value("GL Entry",
 			{"voucher_type": "Journal Entry", "voucher_no": jv.name}))
@@ -33,7 +33,7 @@
 		frappe.db.set_value("Budget", budget.name, "action_if_accumulated_monthly_budget_exceeded", "Stop")
 
 		jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
-			"_Test Bank - _TC", 40000, "_Test Cost Center - _TC")
+			"_Test Bank - _TC", 40000, "_Test Cost Center - _TC", posting_date="2013-02-28")
 
 		self.assertRaises(BudgetError, jv.submit)
 		
@@ -46,9 +46,9 @@
 		budget = make_budget(budget_against="Cost Center")
 
 		frappe.db.set_value("Budget", budget.name, "action_if_accumulated_monthly_budget_exceeded", "Stop")
-
+	
 		jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
-			"_Test Bank - _TC", 40000, "_Test Cost Center - _TC")
+			"_Test Bank - _TC", 40000, "_Test Cost Center - _TC", posting_date="2013-03-02")
 
 		self.assertRaises(BudgetError, jv.submit)
 
@@ -121,7 +121,7 @@
 		frappe.db.set_value("Budget", budget.name, "action_if_accumulated_monthly_budget_exceeded", "Stop")
 
 		jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
-			"_Test Bank - _TC", 40000, "_Test Cost Center - _TC", project="_Test Project")
+			"_Test Bank - _TC", 40000, "_Test Cost Center - _TC", project="_Test Project", posting_date="2013-02-28")
 
 		self.assertRaises(BudgetError, jv.submit)
 		
@@ -134,7 +134,7 @@
 		budget = make_budget(budget_against="Cost Center")
 		
 		jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
-			"_Test Bank - _TC", 150000, "_Test Cost Center - _TC")
+			"_Test Bank - _TC", 150000, "_Test Cost Center - _TC", posting_date="2013-03-28")
 
 		self.assertRaises(BudgetError, jv.submit)
 		
@@ -146,7 +146,7 @@
 		budget = make_budget(budget_against="Project")
 		
 		jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
-			"_Test Bank - _TC", 150000, "_Test Cost Center - _TC", project="_Test Project")
+			"_Test Bank - _TC", 150000, "_Test Cost Center - _TC", project="_Test Project", posting_date="2013-03-28")
 
 		self.assertRaises(BudgetError, jv.submit)
 		
@@ -158,13 +158,13 @@
 		budget = make_budget(budget_against="Cost Center")
 				
 		jv1 = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
-			"_Test Bank - _TC", 20000, "_Test Cost Center - _TC", submit=True)
+			"_Test Bank - _TC", 20000, "_Test Cost Center - _TC", posting_date="2013-02-28", submit=True)
 
 		self.assertTrue(frappe.db.get_value("GL Entry",
 			{"voucher_type": "Journal Entry", "voucher_no": jv1.name}))
 
 		jv2 = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
-			"_Test Bank - _TC", 20000, "_Test Cost Center - _TC", submit=True)
+			"_Test Bank - _TC", 20000, "_Test Cost Center - _TC", posting_date="2013-02-28", submit=True)
 
 		self.assertTrue(frappe.db.get_value("GL Entry",
 			{"voucher_type": "Journal Entry", "voucher_no": jv2.name}))
@@ -182,13 +182,13 @@
 		budget = make_budget(budget_against="Project")
 				
 		jv1 = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
-			"_Test Bank - _TC", 20000, "_Test Cost Center - _TC", submit=True, project="_Test Project")
+			"_Test Bank - _TC", 20000, "_Test Cost Center - _TC", posting_date="2013-02-28", submit=True, project="_Test Project")
 
 		self.assertTrue(frappe.db.get_value("GL Entry",
 			{"voucher_type": "Journal Entry", "voucher_no": jv1.name}))
 
 		jv2 = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
-			"_Test Bank - _TC", 20000, "_Test Cost Center - _TC", submit=True, project="_Test Project")
+			"_Test Bank - _TC", 20000, "_Test Cost Center - _TC", posting_date="2013-02-28", submit=True, project="_Test Project")
 
 		self.assertTrue(frappe.db.get_value("GL Entry",
 			{"voucher_type": "Journal Entry", "voucher_no": jv2.name}))
@@ -200,7 +200,6 @@
 		budget.load_from_db()
 		budget.cancel()
 
-		
 	def test_monthly_budget_against_group_cost_center(self):
 		set_total_expense_zero("2013-02-28", "Cost Center")
 		set_total_expense_zero("2013-02-28", "Cost Center", "_Test Cost Center 2 - _TC")
@@ -209,7 +208,7 @@
 		frappe.db.set_value("Budget", budget.name, "action_if_accumulated_monthly_budget_exceeded", "Stop")
 
 		jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
-			"_Test Bank - _TC", 40000, "_Test Cost Center 2 - _TC")
+			"_Test Bank - _TC", 40000, "_Test Cost Center 2 - _TC", posting_date="2013-02-28")
 
 		self.assertRaises(BudgetError, jv.submit)
 		
@@ -261,10 +260,10 @@
 	if existing_expense:
 		if budget_against_field == "Cost Center":
 			make_journal_entry("_Test Account Cost for Goods Sold - _TC",
-			"_Test Bank - _TC", -existing_expense, "_Test Cost Center - _TC", submit=True)
+			"_Test Bank - _TC", -existing_expense, "_Test Cost Center - _TC", posting_date="2013-02-28", submit=True)
 		elif budget_against_field == "Project":
 			make_journal_entry("_Test Account Cost for Goods Sold - _TC",
-			"_Test Bank - _TC", -existing_expense, "_Test Cost Center - _TC", submit=True, project="_Test Project")
+			"_Test Bank - _TC", -existing_expense, "_Test Cost Center - _TC", submit=True, project="_Test Project", posting_date="2013-02-28")
 
 def make_budget(**args):
 	args = frappe._dict(args)
diff --git a/erpnext/accounts/doctype/journal_entry/test_records.json b/erpnext/accounts/doctype/journal_entry/test_records.json
index b67fc31..5077305 100644
--- a/erpnext/accounts/doctype/journal_entry/test_records.json
+++ b/erpnext/accounts/doctype/journal_entry/test_records.json
@@ -12,14 +12,16 @@
     "credit_in_account_currency": 400.0,
     "debit_in_account_currency": 0.0,
     "doctype": "Journal Entry Account",
-    "parentfield": "accounts"
+    "parentfield": "accounts",
+    "cost_center": "_Test Cost Center - _TC"
    },
    {
     "account": "_Test Bank - _TC",
     "credit_in_account_currency": 0.0,
     "debit_in_account_currency": 400.0,
     "doctype": "Journal Entry Account",
-    "parentfield": "accounts"
+    "parentfield": "accounts",
+    "cost_center": "_Test Cost Center - _TC"
    }
   ],
   "naming_series": "_T-Journal Entry-",
@@ -42,14 +44,16 @@
     "credit_in_account_currency": 0.0,
     "debit_in_account_currency": 400.0,
     "doctype": "Journal Entry Account",
-    "parentfield": "accounts"
+    "parentfield": "accounts",
+    "cost_center": "_Test Cost Center - _TC"
    },
    {
     "account": "_Test Bank - _TC",
     "credit_in_account_currency": 400.0,
     "debit_in_account_currency": 0.0,
     "doctype": "Journal Entry Account",
-    "parentfield": "accounts"
+    "parentfield": "accounts",
+    "cost_center": "_Test Cost Center - _TC"
    }
   ],
   "naming_series": "_T-Journal Entry-",
@@ -72,7 +76,8 @@
     "credit_in_account_currency": 0.0,
     "debit_in_account_currency": 400.0,
     "doctype": "Journal Entry Account",
-    "parentfield": "accounts"
+    "parentfield": "accounts",
+    "cost_center": "_Test Cost Center - _TC"
    },
    {
     "account": "Sales - _TC",
@@ -80,7 +85,8 @@
     "credit_in_account_currency": 400.0,
     "debit_in_account_currency": 0.0,
     "doctype": "Journal Entry Account",
-    "parentfield": "accounts"
+    "parentfield": "accounts",
+    "cost_center": "_Test Cost Center - _TC"
    }
   ],
   "naming_series": "_T-Journal Entry-",
diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
index b0fbc98..94037c7 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -1496,6 +1496,9 @@
 
 		for gle in gl_entries:
 			self.assertEqual(expected_values[gle.account]["cost_center"], gle.cost_center)
+		
+		accounts_settings.allow_cost_center_in_entry_of_bs_account = 0
+		accounts_settings.save()
 
 
 def create_sales_invoice(**args):
diff --git a/erpnext/patches/v7_0/convert_timelog_to_timesheet.py b/erpnext/patches/v7_0/convert_timelog_to_timesheet.py
index d21758d..4177e07 100644
--- a/erpnext/patches/v7_0/convert_timelog_to_timesheet.py
+++ b/erpnext/patches/v7_0/convert_timelog_to_timesheet.py
@@ -1,6 +1,4 @@
 import frappe
-from erpnext.manufacturing.doctype.work_order.work_order \
-	import make_timesheet, add_timesheet_detail
 
 def execute():
 	frappe.reload_doc('projects', 'doctype', 'task')
@@ -8,6 +6,9 @@
 	if not frappe.db.table_exists("Time Log"):
 		return
 
+	from erpnext.manufacturing.doctype.work_order.work_order \
+		import make_timesheet, add_timesheet_detail
+
 	for data in frappe.db.sql("select * from `tabTime Log`", as_dict=1):
 		if data.task:
 			company = frappe.db.get_value("Task", data.task, "company")
diff --git a/erpnext/patches/v7_0/convert_timelogbatch_to_timesheet.py b/erpnext/patches/v7_0/convert_timelogbatch_to_timesheet.py
index e23669b..41364ca 100644
--- a/erpnext/patches/v7_0/convert_timelogbatch_to_timesheet.py
+++ b/erpnext/patches/v7_0/convert_timelogbatch_to_timesheet.py
@@ -1,9 +1,13 @@
 import frappe
 from frappe.utils import cint
-from erpnext.manufacturing.doctype.work_order.work_order import add_timesheet_detail
-from erpnext.patches.v7_0.convert_timelog_to_timesheet import get_timelog_data
 
 def execute():
+	if not frappe.db.exists("DocType", "Time Log Batch"):
+		return
+
+	from erpnext.manufacturing.doctype.work_order.work_order import add_timesheet_detail
+	from erpnext.patches.v7_0.convert_timelog_to_timesheet import get_timelog_data
+
 	for tlb in frappe.get_all('Time Log Batch', fields=["*"], 
 		filters = [["docstatus", "<", "2"]]):
 		time_sheet = frappe.new_doc('Timesheet')
diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
index a2da924..8d2744b 100644
--- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
@@ -383,8 +383,9 @@
 				'location_name': 'Test Location'
 			}).insert()
 
-		pr = make_purchase_receipt()
 		set_perpetual_inventory(1, pr.company)
+		pr = make_purchase_receipt()
+
 		stock_in_hand_account = get_inventory_account(pr.company, pr.get("items")[0].warehouse)
 		gl_entries = get_gl_entries("Purchase Receipt", pr.name)