fixed filtering issue in gs
diff --git a/erpnext/stock/search_criteria/stock_report/stock_report.js b/erpnext/stock/search_criteria/stock_report/stock_report.js
index 5451eb1..d08d1e7 100644
--- a/erpnext/stock/search_criteria/stock_report/stock_report.js
+++ b/erpnext/stock/search_criteria/stock_report/stock_report.js
@@ -19,7 +19,7 @@
   this.mytabs.items['Select Columns'].hide()
   this.mytabs.items['More Filters'].hide()
   this.hide_all_filters();
-  this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Warehouse'+NEWLINE+'Item Code',report_default:'Warehouse',ignore : 1,parent:'Stock Ledger Entry'});
+  this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Warehouse'+NEWLINE+'Item Code',ignore : 1,parent:'Stock Ledger Entry'});
   this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
   this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP +'Item Code'].df.filter_hide = 0;
   this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP +'Warehouse'].df.filter_hide = 0;
@@ -57,8 +57,8 @@
     ware_type_cond = repl(' AND `tabWarehouse`.warehouse_type IN (%(war)s)', {war: war.substr(0,war.length-1)})
   }
   
-  if(based_on.length == 1){
-    if(based_on == 'Item Code'){
+  if(based_on.length == 1 && based_on[0]){
+    if(based_on[0] == 'Item Code'){
       cols = '`tabItem`.name AS "Item Code", `tabItem`.item_name AS "Item Name", `tabItem`.description AS "Description", `tabItem`.stock_uom AS "Stock UOM"';
       cond = '(IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.is_stock_item = "Yes"';
       if(item_code) cond += repl(' AND `tabItem`.name = %(item)s', {item:'"'+item_code+'"'});
@@ -66,7 +66,7 @@
       tables = '`tabItem`';
       group_by = '`tabStock Ledger Entry`.item_code';
     }
-    else if(based_on == 'Warehouse'){
+    else if(based_on[0] == 'Warehouse'){
       cols = '`tabWarehouse`.name AS "Warehouse", `tabWarehouse`.warehouse_type AS "Warehouse Type"';
       cond = '`tabWarehouse`.docstatus < 2'
       if(warehouse) cond += repl(' AND `tabWarehouse`.name = %(warehouse)s', {warehouse:'"'+warehouse+'"'});
@@ -74,8 +74,7 @@
       tables = '`tabWarehouse`';
       group_by = '`tabStock Ledger Entry`.warehouse';
     }
-  }
-  else if(based_on.length == 2){
+  } else {
     cols = '`tabItem`.name AS "Item Code", `tabItem`.item_name AS "Item Name", `tabItem`.description AS "Description", `tabItem`.stock_uom AS "Stock UOM", `tabWarehouse`.name AS "Warehouse",  `tabWarehouse`.warehouse_type AS "Warehouse Type"';
     cond = '(IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.is_stock_item = "Yes" AND `tabWarehouse`.docstatus < 2';
     if(item_code) cond += repl(" AND `tabItem`.name = %(item)s", {item:"'"+item_code+"'"});
@@ -87,4 +86,4 @@
 
   q = repl("SELECT %(cols)s FROM %(tables)s, `tabStock Ledger Entry` WHERE %(cond)s %(date_cond)s GROUP BY %(group_by)s", {cols:cols, tables:tables, cond:cond, date_cond:date_cond, group_by:group_by});
   return q;
-}
\ No newline at end of file
+}
diff --git a/erpnext/stock/search_criteria/stock_report/stock_report.py b/erpnext/stock/search_criteria/stock_report/stock_report.py
index 84866e9..b87f684 100644
--- a/erpnext/stock/search_criteria/stock_report/stock_report.py
+++ b/erpnext/stock/search_criteria/stock_report/stock_report.py
@@ -14,19 +14,16 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-if not filter_values.get('based_on'):
-  msgprint("Please Select Based On")
-  raise Exception
 cols, columns = [], []
 # Add columns
 # ------------
 based_on = filter_values.get('based_on').split(NEWLINE)
-if len(based_on) == 1:
+if len(based_on) == 1 and based_on[0]:
   if based_on[0] == 'Item Code':
     cols = ["Item Code", "Item Name", "Description", "Stock UOM"]
   elif based_on[0] == 'Warehouse':
     cols = ["Warehouse", "Warehouse Type"]
-elif len(based_on) == 2:
+else:
   cols = ["Item Code", "Item Name", "Description", "Stock UOM", "Warehouse",  "Warehouse Type"]
 
 for d in cols:
@@ -65,7 +62,7 @@
 cl_bal,tot_stock = 0,0
   
 for r in res:
-  if len(based_on) == 1:
+  if len(based_on) == 1 and based_on[0]:
     if based_on[0] == 'Item Code': closing_balance, stock_value = get_values(msgprint, flt, posting_date, item_code = r[col_idx['Item Code']])
     elif based_on[0] == 'Warehouse': closing_balance, stock_value = get_values(msgprint, flt, posting_date, warehouse = r[col_idx['Warehouse']])
     r.append(closing_balance)