diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
index bb489e7..4ea18ac 100644
--- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
@@ -50,9 +50,9 @@
 		pi = frappe.copy_doc(test_records[1])
 		pi.insert()
 		pi.submit()
-		
+
 		self.check_gle_for_pi(pi.name)
-		
+
 		set_perpetual_inventory(0)
 
 	def test_gl_entries_with_auto_accounting_for_stock_against_pr(self):
@@ -316,59 +316,59 @@
 			where voucher_type='Sales Invoice' and voucher_no=%s""", pi.name)
 
 		self.assertFalse(gle)
-	
+
 	def test_purchase_invoice_update_stock_gl_entry_with_perpetual_inventory(self):
 		set_perpetual_inventory()
-		
-		pi = make_purchase_invoice(update_stock=1, posting_date=frappe.utils.nowdate(), 
+
+		pi = make_purchase_invoice(update_stock=1, posting_date=frappe.utils.nowdate(),
 			posting_time=frappe.utils.nowtime())
-		
+
 		gl_entries = frappe.db.sql("""select account, account_currency, debit, credit,
 			debit_in_account_currency, credit_in_account_currency
 			from `tabGL Entry` where voucher_type='Purchase Invoice' and voucher_no=%s
 			order by account asc""", pi.name, as_dict=1)
 
 		self.assertTrue(gl_entries)
-		
+
 		expected_gl_entries = dict((d[0], d) for d in [
 			[pi.credit_to, 0.0, 250.0],
 			[pi.items[0].warehouse, 250.0, 0.0]
 		])
-		
+
 		for i, gle in enumerate(gl_entries):
 			self.assertEquals(expected_gl_entries[gle.account][0], gle.account)
 			self.assertEquals(expected_gl_entries[gle.account][1], gle.debit)
 			self.assertEquals(expected_gl_entries[gle.account][2], gle.credit)
-			
+
 	def test_purchase_invoice_for_is_paid_and_update_stock_gl_entry_with_perpetual_inventory(self):
 		set_perpetual_inventory()
-		pi = make_purchase_invoice(update_stock=1, posting_date=frappe.utils.nowdate(), 
+		pi = make_purchase_invoice(update_stock=1, posting_date=frappe.utils.nowdate(),
 			posting_time=frappe.utils.nowtime(), cash_bank_account="Cash - _TC", is_paid=1)
 
-		gl_entries = frappe.db.sql("""select account, account_currency, sum(debit) as debit, 
-				sum(credit) as credit, debit_in_account_currency, credit_in_account_currency 
-			from `tabGL Entry` where voucher_type='Purchase Invoice' and voucher_no=%s 
+		gl_entries = frappe.db.sql("""select account, account_currency, sum(debit) as debit,
+				sum(credit) as credit, debit_in_account_currency, credit_in_account_currency
+			from `tabGL Entry` where voucher_type='Purchase Invoice' and voucher_no=%s
 			group by account, voucher_no order by account asc;""", pi.name, as_dict=1)
 
 		self.assertTrue(gl_entries)
-		
+
 		expected_gl_entries = dict((d[0], d) for d in [
 			[pi.credit_to, 250.0, 250.0],
 			[pi.items[0].warehouse, 250.0, 0.0],
 			["Cash - _TC", 0.0, 250.0]
 		])
-				
+
 		for i, gle in enumerate(gl_entries):
 			self.assertEquals(expected_gl_entries[gle.account][0], gle.account)
 			self.assertEquals(expected_gl_entries[gle.account][1], gle.debit)
 			self.assertEquals(expected_gl_entries[gle.account][2], gle.credit)
-	
+
 	def test_update_stock_and_purchase_return(self):
 		actual_qty_0 = get_qty_after_transaction()
-		
+
 		pi = make_purchase_invoice(update_stock=1, posting_date=frappe.utils.nowdate(),
 			posting_time=frappe.utils.nowtime())
-		
+
 		actual_qty_1 = get_qty_after_transaction()
 		self.assertEquals(actual_qty_0 + 5, actual_qty_1)
 
@@ -377,37 +377,38 @@
 
 		actual_qty_2 = get_qty_after_transaction()
 		self.assertEquals(actual_qty_1 - 2, actual_qty_2)
-		
+
 		pi1.cancel()
 		self.assertEquals(actual_qty_1, get_qty_after_transaction())
-		
+
+		pi.reload()
 		pi.cancel()
 		self.assertEquals(actual_qty_0, get_qty_after_transaction())
-		
+
 	def test_subcontracting_via_purchase_invoice(self):
 		from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
-		
+
 		make_stock_entry(item_code="_Test Item", target="_Test Warehouse 1 - _TC", qty=100, basic_rate=100)
-		make_stock_entry(item_code="_Test Item Home Desktop 100", target="_Test Warehouse 1 - _TC", 
+		make_stock_entry(item_code="_Test Item Home Desktop 100", target="_Test Warehouse 1 - _TC",
 			qty=100, basic_rate=100)
-		
-		pi = make_purchase_invoice(item_code="_Test FG Item", qty=10, rate=500, 
+
+		pi = make_purchase_invoice(item_code="_Test FG Item", qty=10, rate=500,
 			update_stock=1, is_subcontracted="Yes")
-		
+
 		self.assertEquals(len(pi.get("supplied_items")), 2)
-		
+
 		rm_supp_cost = sum([d.amount for d in pi.get("supplied_items")])
 		self.assertEquals(pi.get("items")[0].rm_supp_cost, flt(rm_supp_cost, 2))
-		
+
 	def test_rejected_serial_no(self):
 		pi = make_purchase_invoice(item_code="_Test Serialized Item With Series", received_qty=2, qty=1,
 			rejected_qty=1, rate=500, update_stock=1,
 			rejected_warehouse = "_Test Rejected Warehouse - _TC")
-		
+
 		self.assertEquals(frappe.db.get_value("Serial No", pi.get("items")[0].serial_no, "warehouse"),
 			pi.get("items")[0].warehouse)
-			
-		self.assertEquals(frappe.db.get_value("Serial No", pi.get("items")[0].rejected_serial_no, 
+
+		self.assertEquals(frappe.db.get_value("Serial No", pi.get("items")[0].rejected_serial_no,
 			"warehouse"), pi.get("items")[0].rejected_warehouse)
 
 def make_purchase_invoice(**args):
@@ -420,10 +421,10 @@
 		pi.update_stock = 1
 	if args.is_paid:
 		pi.is_paid = 1
-		
+
 	if args.cash_bank_account:
 		pi.cash_bank_account=args.cash_bank_account
-		
+
 	pi.company = args.company or "_Test Company"
 	pi.supplier = args.supplier or "_Test Supplier"
 	pi.currency = args.currency or "INR"
