Merge pull request #2640 from anandpdoshi/anand-jan-27

Fixes to Error Reports
diff --git a/README.md b/README.md
index efa3e33..f2b628e 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,7 @@
 # ERPNext - Open source ERP for small and medium-size business [![Build Status](https://travis-ci.org/frappe/erpnext.png)](https://travis-ci.org/frappe/erpnext)
 
+[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/frappe/erpnext?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+
 [https://erpnext.com](https://erpnext.com)
 
 Includes: Accounting, Inventory, CRM, Sales, Purchase, Projects, HRMS. Requires MariaDB.
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 8978a3b..bfce346 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -92,4 +92,4 @@
 erpnext.patches.v4_2.recalculate_bom_costs
 erpnext.patches.v4_2.discount_amount
 erpnext.patches.v4_2.update_landed_cost_voucher
-erpnext.patches.v4_2.set_item_batch
+erpnext.patches.v4_2.set_item_has_batch
diff --git a/erpnext/patches/v4_2/set_item_batch.py b/erpnext/patches/v4_2/set_item_has_batch.py
similarity index 94%
rename from erpnext/patches/v4_2/set_item_batch.py
rename to erpnext/patches/v4_2/set_item_has_batch.py
index 3e84a59..35ed2e0 100644
--- a/erpnext/patches/v4_2/set_item_batch.py
+++ b/erpnext/patches/v4_2/set_item_has_batch.py
@@ -44,7 +44,7 @@
 def get_sle_with_batch():
 	sle_with_batch = {}
 	for d in frappe.db.sql("""select item_code, count(name) as cnt from `tabStock Ledger Entry` 
-		where batch_no != '' group by item_code""", as_dict=1):
+		where ifnull(batch_no, '') != '' group by item_code""", as_dict=1):
 			sle_with_batch.setdefault(d.item_code, d.cnt)
 		
 	return sle_with_batch
@@ -53,7 +53,7 @@
 def get_sle_with_serial():
 	sle_with_serial = {}
 	for d in frappe.db.sql("""select item_code, count(name) as cnt from `tabStock Ledger Entry` 
-		where serial_no != '' group by item_code""", as_dict=1):
+		where ifnull(serial_no, '') != '' group by item_code""", as_dict=1):
 			sle_with_serial.setdefault(d.item_code, d.cnt)
 	
 	return sle_with_serial