Merge branch 'master' of github.com:webnotes/erpnext
diff --git a/accounts/page/voucher_import_tool/voucher_import_tool.py b/accounts/page/voucher_import_tool/voucher_import_tool.py
index ab81801..0d3a7f7 100644
--- a/accounts/page/voucher_import_tool/voucher_import_tool.py
+++ b/accounts/page/voucher_import_tool/voucher_import_tool.py
@@ -230,7 +230,7 @@
 				accounts = [c for c in rows[i+1] if c.endswith(" - " + company_abbr)]
 				
 				if accounts and (len(columns) != rows[i+1].index(accounts[0])):
-					raise Exception, """A non-account column cannot be after an account \
-						column. Please rectify it in the file and try again."""
+					raise Exception, """All account columns should be after standard columns and \
+						on the right. Please rectify it in the file and try again."""
 				
 	return data, start_row_idx
\ No newline at end of file
diff --git a/stock/doctype/purchase_receipt/purchase_receipt.js b/stock/doctype/purchase_receipt/purchase_receipt.js
index b3efb14..23aa2cc 100644
--- a/stock/doctype/purchase_receipt/purchase_receipt.js
+++ b/stock/doctype/purchase_receipt/purchase_receipt.js
@@ -150,9 +150,10 @@
 cur_frm.cscript.received_qty = function(doc, cdt, cdn) {
 	var d = locals[cdt][cdn];
 	ret = {
-			'qty' : d.qty ? d.qty : d.received_qty,
+			'qty' : (flt(d.qty) && flt(d.qty) < flt(d.received_qty)) 
+			 	? flt(d.qty) : flt(d.received_qty),
 			'stock_qty': 0,
-			'rejected_qty' : 0
+			'rejected_qty' : 0,
 		}
 	set_multiple('Purchase Receipt Item', cdn, ret, 'purchase_receipt_details');
 	cur_frm.cscript.calc_amount(doc, 2);