Merge pull request #1170 from akhileshdarjee/master

[fix] [minor] rename fix for customer and supplier
diff --git a/accounts/doctype/gl_entry/gl_entry.py b/accounts/doctype/gl_entry/gl_entry.py
index 3a0b28c..d3c6317 100644
--- a/accounts/doctype/gl_entry/gl_entry.py
+++ b/accounts/doctype/gl_entry/gl_entry.py
@@ -5,8 +5,7 @@
 import webnotes
 
 from webnotes.utils import flt, fmt_money, getdate
-from webnotes.model.code import get_obj
-from webnotes import msgprint, _
+from webnotes import _
 	
 class DocType:
 	def __init__(self,d,dl):
@@ -130,11 +129,12 @@
 		against_voucher_amount = flt(webnotes.conn.sql("""
 			select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
 			from `tabGL Entry` where voucher_type = 'Journal Voucher' and voucher_no = %s
-			and account = %s""", (against_voucher, account))[0][0])
+			and account = %s and ifnull(against_voucher, '') = ''""", 
+			(against_voucher, account))[0][0])
 		bal = against_voucher_amount + bal
 		if against_voucher_amount < 0:
 			bal = -bal
-		
+	
 	# Validation : Outstanding can not be negative
 	if bal < 0 and not on_cancel:
 		webnotes.throw(_("Outstanding for Voucher ") + against_voucher + _(" will become ") + 
@@ -158,4 +158,4 @@
 		elif frozen_accounts_modifier not in webnotes.user.get_roles():
 			webnotes.throw(account + _(" is a frozen account. ") + 
 				_("To create / edit transactions against this account, you need role") + ": " +  
-				frozen_accounts_modifier)
+				frozen_accounts_modifier)
\ No newline at end of file
diff --git a/stock/doctype/serial_no/serial_no.py b/stock/doctype/serial_no/serial_no.py
index dc067ec..bd2704d 100644
--- a/stock/doctype/serial_no/serial_no.py
+++ b/stock/doctype/serial_no/serial_no.py
@@ -150,7 +150,7 @@
 			where serial_no like %s and item_code=%s and ifnull(is_cancelled, 'No')='No' 
 			order by posting_date desc, posting_time desc, name desc""", 
 			("%%%s%%" % self.doc.name, self.doc.item_code), as_dict=1):
-				if self.doc.name in get_serial_nos(sle.serial_no):
+				if self.doc.name.upper() in get_serial_nos(sle.serial_no):
 					if sle.actual_qty > 0:
 						sle_dict.setdefault("incoming", []).append(sle)
 					else:
@@ -268,7 +268,8 @@
 		from tabItem where name=%s""", item_code, as_dict=True)[0]
 		
 def get_serial_nos(serial_no):
-	return [s.strip() for s in cstr(serial_no).strip().replace(',', '\n').split('\n') if s.strip()]
+	return [s.strip() for s in cstr(serial_no).strip().upper().replace(',', '\n').split('\n') 
+		if s.strip()]
 
 def make_serial_no(serial_no, sle):
 	sr = webnotes.new_bean("Serial No")