Test case fix and other minor bug fix
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index f771181..dc4c94c 100755
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -568,10 +568,10 @@
 erpnext.patches.v11_0.add_default_dispatch_notification_template
 erpnext.patches.v11_0.add_market_segments
 erpnext.patches.v11_0.add_sales_stages
-execute:frappe.delete_doc("Page", "Sales Analytics")
-execute:frappe.delete_doc("Page", "Purchase Analytics")
-execute:frappe.delete_doc("Page", "Stock Analytics")
-execute:frappe.delete_doc("Page", "Production Analytics")
+execute:frappe.delete_doc("Page", "sales-analytics")
+execute:frappe.delete_doc("Page", "purchase-analytics")
+execute:frappe.delete_doc("Page", "stock-analytics")
+execute:frappe.delete_doc("Page", "production-analytics")
 erpnext.patches.v11_0.ewaybill_fields_gst_india #2018-11-13
 erpnext.patches.v11_0.drop_column_max_days_allowed
 erpnext.patches.v11_0.change_healthcare_desktop_icons
diff --git a/erpnext/selling/report/sales_analytics/sales_analytics.js b/erpnext/selling/report/sales_analytics/sales_analytics.js
index 7c9e3ec..718f29c 100644
--- a/erpnext/selling/report/sales_analytics/sales_analytics.js
+++ b/erpnext/selling/report/sales_analytics/sales_analytics.js
@@ -67,23 +67,16 @@
 			reqd: 1
 		}
 	],
-	"formatter": function(value, row, column, data) {
-		if(!value){
-			value = 0
-		}
-		return value;
-	},
 	get_datatable_options(options) {
 		return Object.assign(options, {
 			checkboxColumn: true,
 			events: {
 				onCheckRow: function(data) {
 					row_name = data[2].content;
-					row_values = data.slice(5).map(function (column) {
+					row_values = data.slice(4).map(function (column) {
 						return column.content;
 					})
-
-					entry  = {
+					entry = {
 						'name':row_name,
 						'values':row_values
 					}
diff --git a/erpnext/selling/report/sales_analytics/sales_analytics.py b/erpnext/selling/report/sales_analytics/sales_analytics.py
index ef9e666..2cc2f70 100644
--- a/erpnext/selling/report/sales_analytics/sales_analytics.py
+++ b/erpnext/selling/report/sales_analytics/sales_analytics.py
@@ -275,7 +275,7 @@
 		self.parent_child_map = frappe._dict(frappe.db.sql(""" select name, supplier_group from `tabSupplier`"""))
 
 	def get_chart_data(self):
-		labels = [d.get("label") for d in self.columns[3:]]
+		labels = [d.get("label") for d in self.columns[2:]]
 		self.chart = {
 			"data": {
 				'labels': labels,
diff --git a/erpnext/selling/report/sales_analytics/test_analytics.py b/erpnext/selling/report/sales_analytics/test_analytics.py
index c9a00fa..28c5bac 100644
--- a/erpnext/selling/report/sales_analytics/test_analytics.py
+++ b/erpnext/selling/report/sales_analytics/test_analytics.py
@@ -9,9 +9,6 @@
 
 class TestAnalytics(unittest.TestCase):
 
-	def tearDown(self):
-		frappe.db.sql(""" DELETE FROM `tabSales Order` """)
-
 	def test_by_entity(self):
 		create_sales_order()
 
@@ -20,7 +17,7 @@
 			'range': 'Monthly',
 			'to_date': '2018-03-31',
 			'tree_type': 'Customer',
-			'company': '_Test Company',
+			'company': '_Test Company 2',
 			'from_date': '2017-04-01',
 			'value_quantity': 'Value'
 		}
@@ -83,14 +80,13 @@
 		self.assertEqual(expected_data, report[1])
 
 	def test_by_group(self):
-		create_sales_order()
-
+	
 		filters = {
 			'doc_type': 'Sales Order',
 			'range': 'Monthly',
 			'to_date': '2018-03-31',
 			'tree_type': 'Customer Group',
-			'company': '_Test Company',
+			'company': '_Test Company 2',
 			'from_date': '2017-04-01',
 			'value_quantity': 'Value'
 		}
@@ -170,14 +166,13 @@
 		self.assertEqual(expected_data, report[1])
 	
 	def test_by_quantity(self):
-		create_sales_order()
 
 		filters = {
 			'doc_type': 'Sales Order',
 			'range': 'Monthly',
 			'to_date': '2018-03-31',
 			'tree_type': 'Customer',
-			'company': '_Test Company',
+			'company': '_Test Company 2',
 			'from_date': '2017-04-01',
 			'value_quantity': 'Quantity'
 		}
@@ -242,9 +237,39 @@
 def create_sales_order():
 	frappe.set_user("Administrator")
 
-	make_sales_order(qty=10, customer = "_Test Customer 1", transaction_date='2018-02-10')
-	make_sales_order(qty=10, customer = "_Test Customer 1", transaction_date='2018-02-15')
-	make_sales_order(qty=15, customer = "_Test Customer 2", transaction_date='2017-09-23')
-	make_sales_order(qty=10, customer = "_Test Customer 2", transaction_date='2017-10-10')
-	make_sales_order(qty=20, customer = "_Test Customer 3", transaction_date='2017-06-15')
-	make_sales_order(qty=10, customer = "_Test Customer 3", transaction_date='2017-07-10')
+	make_sales_order(company="_Test Company 2", qty=10,
+		customer = "_Test Customer 1",
+		transaction_date = '2018-02-10',
+		warehouse = 'Finished Goods - _TC2',
+		currency = 'EUR')
+
+	make_sales_order(company="_Test Company 2",
+		qty=10, customer = "_Test Customer 1",
+		transaction_date = '2018-02-15',
+		warehouse = 'Finished Goods - _TC2',
+		currency = 'EUR')
+
+	make_sales_order(company = "_Test Company 2",
+		qty=10, customer = "_Test Customer 2",
+		transaction_date = '2017-10-10',
+		warehouse='Finished Goods - _TC2',
+		currency = 'EUR')
+
+	make_sales_order(company="_Test Company 2",
+		qty=15, customer = "_Test Customer 2",
+		transaction_date='2017-09-23',
+		warehouse='Finished Goods - _TC2',
+		currency = 'EUR')
+		
+	make_sales_order(company="_Test Company 2",
+		qty=20, customer = "_Test Customer 3",
+		transaction_date='2017-06-15',
+		warehouse='Finished Goods - _TC2',
+		currency = 'EUR')
+		
+	make_sales_order(company="_Test Company 2",
+		qty=10, customer = "_Test Customer 3",
+		transaction_date='2017-07-10',
+		warehouse='Finished Goods - _TC2',
+		currency = 'EUR')
+