added warehouse user to retrict entry and also introduced query handlers
diff --git a/stock/utils.py b/stock/utils.py
index 46dd9d0..87f4c02 100644
--- a/stock/utils.py
+++ b/stock/utils.py
@@ -146,4 +146,21 @@
 			+ cstr(abs(qty)) + " quantity against item code: " + item_code,
 			raise_exception=1)
 		
-	return valid_serial_nos
\ No newline at end of file
+	return valid_serial_nos
+	
+def get_warehouse_list(doctype, txt, searchfield, start, page_len):
+	"""used in search queries"""
+	wlist = []
+	for w in webnotes.conn.sql_list("""select name from tabWarehouse 
+		where name like '%%%s%%'""" % txt):
+		if webnotes.session.user=="Administrator":
+			wlist.append([w])
+		else:
+			warehouse_users = webnotes.conn.sql_list("""select user from `tabWarehouse User` 
+				where parent=%s""", w)
+			if not warehouse_users:
+				wlist.append([w])
+			elif webnotes.session.user in warehouse_users:
+				wlist.append([w])
+	return wlist
+	
\ No newline at end of file