feat: stock module dashboard and onboarding
diff --git a/erpnext/accounts/dashboard_fixtures.py b/erpnext/accounts/dashboard_fixtures.py
index cdd3758..1eed5a0 100644
--- a/erpnext/accounts/dashboard_fixtures.py
+++ b/erpnext/accounts/dashboard_fixtures.py
@@ -81,7 +81,7 @@
 			"timespan": "Last Year",
 			"color": "#a83333",
 			"value_based_on": "base_net_total",
-			"filters_json": json.dumps({"docstatus": 1}),
+			"filters_json": json.dumps([["Purchase Invoice", "docstatus", "=", 1]]),
 			"chart_type": "Sum",
 			"timeseries": 1,
 			"based_on": "posting_date",
@@ -99,7 +99,7 @@
 			"timespan": "Last Year",
 			"color": "#7b933d",
 			"value_based_on": "base_net_total",
-			"filters_json": json.dumps({"docstatus": 1}),
+			"filters_json": json.dumps([["Sales Invoice", "docstatus", "=", 1]]),
 			"chart_type": "Sum",
 			"timeseries": 1,
 			"based_on": "posting_date",
diff --git a/erpnext/stock/dashboard_chart_source/warehouse_wise_stock_value/warehouse_wise_stock_value.py b/erpnext/stock/dashboard_chart_source/warehouse_wise_stock_value/warehouse_wise_stock_value.py
index 05a5068..374a34e 100644
--- a/erpnext/stock/dashboard_chart_source/warehouse_wise_stock_value/warehouse_wise_stock_value.py
+++ b/erpnext/stock/dashboard_chart_source/warehouse_wise_stock_value/warehouse_wise_stock_value.py
@@ -29,7 +29,7 @@
 	if not warehouses:
 		return []
 
-	sorted_warehouse_map = sorted(warehouses, key = lambda i: i['balance'],reverse=True)
+	sorted_warehouse_map = sorted(warehouses, key = lambda i: i['balance'], reverse=True)
 
 	if len(sorted_warehouse_map) > 10:
 		sorted_warehouse_map = sorted_warehouse_map[:10]
diff --git a/erpnext/stock/dashboard_fixtures.py b/erpnext/stock/dashboard_fixtures.py
index d1a3a14..0f1fd12 100644
--- a/erpnext/stock/dashboard_fixtures.py
+++ b/erpnext/stock/dashboard_fixtures.py
@@ -3,6 +3,7 @@
 
 import frappe
 import json
+from frappe import _
 from frappe.utils import nowdate
 from erpnext.accounts.utils import get_fiscal_year
 
@@ -34,39 +35,72 @@
 		"name": "Stock",
 		"dashboard_name": "Stock",
 		"charts": [
-			{ "chart": "Item Shortage Summary", "width": "Half"},
-			{ "chart": "Stock Ageing", "width": "Half"},
-			{ "chart": "Item Wise Annual Revenue", "width": "Half"},
-			{ "chart": "Item Wise Annual Expenditure", "width": "Half"},
-			{ "chart": "Warehouse wise Stock Value", "width": "Full"}
+			{ "chart": "Warehouse wise Stock Value", "width": "Full"},
+			{ "chart": "Purchase Receipt Trends", "width": "Half"},
+			{ "chart": "Delivery Trends", "width": "Half"},
+			{ "chart": "Oldest Items", "width": "Half"},
+			{ "chart": "Item Shortage Summary", "width": "Half"}
 		],
 		"cards": [
-			{ "card": "Purchase Receipts to Bill"},
-			{ "card": "Amount Payable against Receipt"},
-			{ "card": "Delivery Notes to Bill"},
-			{ "card": "Amount Receivable against Delivery"}
+			{ "card": "Total Active Items"},
+			{ "card": "Total Warehouses"},
+			{ "card": "Total Stock Value"}
 		]
 	}]
 
 def get_charts():
 	return [
 		{
-			"name": "Item Shortage Summary",
-			"chart_name": "Item Shortage Summary",
-			"chart_type": "Report",
 			"doctype": "Dashboard Chart",
-			"filters_json": json.dumps({
-				"company": company.name
-			}),
-			"is_custom": 1,
+			"name": "Purchase Receipt Trends",
+			"time_interval": "Monthly",
+			"chart_name": _("Purchase Receipt Trends"),
+			"timespan": "Last Year",
+			"color": "#7b933d",
+			"value_based_on": "base_net_total",
+			"filters_json": json.dumps([["Purchase Receipt", "docstatus", "=", 1]]),
+			"chart_type": "Sum",
+			"timeseries": 1,
+			"based_on": "posting_date",
+			"owner": "Administrator",
+			"document_type": "Purchase Receipt",
+			"type": "Bar",
+			"width": "Half",
+			"is_public": 1
+		},
+		{
+			"doctype": "Dashboard Chart",
+			"name": "Delivery Trends",
+			"time_interval": "Monthly",
+			"chart_name": _("Delivery Trends"),
+			"timespan": "Last Year",
+			"color": "#7b933d",
+			"value_based_on": "base_net_total",
+			"filters_json": json.dumps([["Delivery Note", "docstatus", "=", 1]]),
+			"chart_type": "Sum",
+			"timeseries": 1,
+			"based_on": "posting_date",
+			"owner": "Administrator",
+			"document_type": "Delivery Note",
+			"type": "Bar",
+			"width": "Half",
+			"is_public": 1
+		},
+		{
+			"name": "Warehouse wise Stock Value",
+			"chart_name": _("Warehouse wise Stock Value"),
+			"chart_type": "Custom",
+			"doctype": "Dashboard Chart",
+			"filters_json": json.dumps({}),
+			"is_custom": 0,
 			"is_public": 1,
 			"owner": "Administrator",
-			"report_name": "Item Shortage Report",
+			"source": "Warehouse wise Stock Value",
 			"type": "Bar"
 		},
 		{
-			"name": "Stock Ageing",
-			"chart_name": "Stock Ageing",
+			"name": "Oldest Items",
+			"chart_name": _("Oldest Items"),
 			"chart_type": "Report",
 			"custom_options": json.dumps({
 				"colors": ["#5e64ff"]
@@ -84,127 +118,55 @@
 			"type": "Bar"
 		},
 		{
-			"name": "Item Wise Annual Revenue",
-			"chart_name": "Item Wise Annual Revenue",
+			"name": "Item Shortage Summary",
+			"chart_name": _("Item Shortage Summary"),
 			"chart_type": "Report",
-			"custom_options": json.dumps({
-				"axisOptions": {"shortenYAxisNumbers": 1},
-				"tooltipOptions": {},
-				"colors":["#5e64ff"]
-			}),
 			"doctype": "Dashboard Chart",
 			"filters_json": json.dumps({
-				"period": "Monthly",
-				"based_on": "Item",
-				"fiscal_year": fiscal_year_name,
 				"company": company.name
 			}),
 			"is_custom": 1,
 			"is_public": 1,
 			"owner": "Administrator",
-			"report_name": "Delivery Note Trends",
-			"type": "Bar"
-		},
-		{
-			"name": "Item Wise Annual Expenditure",
-			"chart_name": "Item Wise Annual Expenditure",
-			"chart_type": "Report",
-			"custom_options": json.dumps({
-				"axisOptions": {"shortenYAxisNumbers": 1},
-				"tooltipOptions": {}
-			}),
-			"doctype": "Dashboard Chart",
-			"filters_json": json.dumps({
-				"period": "Monthly",
-				"based_on": "Item",
-				"fiscal_year": fiscal_year_name,
-				"company": company.name,
-				"period_based_on": "posting_date"
-			}),
-			"is_custom": 1,
-			"is_public": 1,
-			"owner": "Administrator",
-			"report_name": "Purchase Receipt Trends",
-			"type": "Bar"
-		},
-		{
-			"name": "Warehouse wise Stock Value",
-			"chart_name": "Warehouse wise Stock Value",
-			"chart_type": "Custom",
-			"doctype": "Dashboard Chart",
-			"filters_json": json.dumps({}),
-			"is_custom": 0,
-			"is_public": 1,
-			"owner": "Administrator",
-			"source": "Warehouse wise Stock Value",
+			"report_name": "Item Shortage Report",
 			"type": "Bar"
 		}
-
 	]
 
 def get_number_cards():
 	return [
 		{
-			"name": "Amount Payable against Receipt",
-			"label": "Amount Payable against Receipt",
-			"function": "Sum",
-			"aggregate_function_based_on": "base_grand_total",
-			"doctype": "Number Card",
-			"document_type": "Purchase Receipt",
-			"filters_json": json.dumps(
-				[["Purchase Receipt","status","=","To Bill",False],
-				["Purchase Receipt","company","=", company.name, False],
-				["Purchase Receipt", "posting_date", "Between", [start_date,end_date], False]]
-			),
-			"is_public": 1,
-			"owner": "Administrator",
-			"show_percentage_stats": 1,
-			"stats_time_interval": "Daily"
-		},
-		{
-			"name": "Amount Receivable against Delivery",
-			"label": "Amount Receivable against Delivery",
-			"function": "Sum",
-			"aggregate_function_based_on": "base_grand_total",
-			"doctype": "Number Card",
-			"document_type": "Delivery Note",
-			"filters_json": json.dumps(
-				[["Delivery Note","company","=",company.name,False],
-				["Delivery Note","status","=","To Bill",False],
-				["Delivery Note", "posting_date", "Between", [start_date,end_date], False]]
-			),
-			"is_public": 1,
-			"owner": "Administrator",
-			"show_percentage_stats": 1,
-			"stats_time_interval": "Daily"
-		},
-		{
-			"name": "Purchase Receipts to Bill",
-			"label": "Purchase Receipts to Bill",
+			"name": "Total Active Items",
+			"label": _("Total Active Items"),
 			"function": "Count",
 			"doctype": "Number Card",
-			"document_type": "Purchase Receipt",
-			"filters_json": json.dumps(
-				[["Purchase Receipt","status","=","To Bill",False],
-				["Purchase Receipt","company","=", company.name, False],
-				["Purchase Receipt", "posting_date", "Between", [start_date,end_date], False]]
-			),
+			"document_type": "Item",
+			"filters_json": json.dumps([["Item", "disabled", "=", 0]]),
 			"is_public": 1,
 			"owner": "Administrator",
 			"show_percentage_stats": 1,
-			"stats_time_interval": "Daily"
+			"stats_time_interval": "Monthly"
 		},
 		{
-			"name": "Delivery Notes to Bill",
-			"label": "Delivery Notes to Bill",
+			"name": "Total Warehouses",
+			"label": _("Total Warehouses"),
 			"function": "Count",
 			"doctype": "Number Card",
-			"document_type": "Delivery Note",
-			"filters_json": json.dumps(
-				[["Delivery Note","company","=",company.name,False],
-				["Delivery Note","status","=","To Bill",False],
-				["Delivery Note", "posting_date", "Between", [start_date,end_date], False]]
-			),
+			"document_type": "Warehouse",
+			"filters_json": json.dumps([["Warehouse", "disabled", "=", 0]]),
+			"is_public": 1,
+			"owner": "Administrator",
+			"show_percentage_stats": 1,
+			"stats_time_interval": "Monthly"
+		},
+		{
+			"name": "Total Stock Value",
+			"label": _("Total Stock Value"),
+			"function": "Sum",
+			"aggregate_function_based_on": "stock_value",
+			"doctype": "Number Card",
+			"document_type": "Bin",
+			"filters_json": json.dumps([]),
 			"is_public": 1,
 			"owner": "Administrator",
 			"show_percentage_stats": 1,
diff --git a/erpnext/stock/desk_page/stock/stock.json b/erpnext/stock/desk_page/stock/stock.json
index 6b93449..4506664 100644
--- a/erpnext/stock/desk_page/stock/stock.json
+++ b/erpnext/stock/desk_page/stock/stock.json
@@ -54,10 +54,11 @@
  "docstatus": 0,
  "doctype": "Desk Page",
  "extends_another_page": 0,
+ "hide_custom": 0,
  "idx": 0,
  "is_standard": 1,
  "label": "Stock",
- "modified": "2020-05-15 04:11:36.326013",
+ "modified": "2020-05-19 17:36:08.185652",
  "modified_by": "Administrator",
  "module": "Stock",
  "name": "Stock",
@@ -112,6 +113,11 @@
    "label": "Stock Balance",
    "link_to": "Stock Balance",
    "type": "Report"
+  },
+  {
+   "label": "Stock Dashboard",
+   "link_to": "Stock",
+   "type": "Dashboard"
   }
  ],
  "shortcuts_label": "Quick Access"
diff --git a/erpnext/stock/module_onboarding/stock/stock.json b/erpnext/stock/module_onboarding/stock/stock.json
index 5208dcb..de24575 100644
--- a/erpnext/stock/module_onboarding/stock/stock.json
+++ b/erpnext/stock/module_onboarding/stock/stock.json
@@ -19,32 +19,32 @@
  "documentation_url": "https://docs.erpnext.com/docs/user/manual/en/stock",
  "idx": 0,
  "is_complete": 0,
- "modified": "2020-05-19 13:13:19.157316",
+ "modified": "2020-05-19 19:03:23.602423",
  "modified_by": "Administrator",
  "module": "Stock",
  "name": "Stock",
  "owner": "Administrator",
  "steps": [
   {
-   "step": "Create a Warehouse"
+   "step": "Setup your Warehouse"
   },
   {
    "step": "Create a Product"
   },
   {
-   "step": "Stock Settings"
-  },
-  {
    "step": "Introduction to Stock Entry"
   },
   {
    "step": "Create a Stock Entry"
   },
   {
-   "step": "Introduction to Price List and Item Price"
+   "step": "Create a Supplier"
   },
   {
-   "step": "Create a Price List"
+   "step": "Create a Purchase Receipt"
+  },
+  {
+   "step": "Stock Settings"
   }
  ],
  "subtitle": "Inventory, Warehouses, Analysis and more.",
diff --git a/erpnext/stock/onboarding_step/create_a_price_list/create_a_price_list.json b/erpnext/stock/onboarding_step/create_a_price_list/create_a_price_list.json
deleted file mode 100644
index ce5b5ec..0000000
--- a/erpnext/stock/onboarding_step/create_a_price_list/create_a_price_list.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "action": "Create Entry",
- "creation": "2020-05-15 03:26:41.917046",
- "docstatus": 0,
- "doctype": "Onboarding Step",
- "idx": 0,
- "is_complete": 0,
- "is_mandatory": 0,
- "is_single": 0,
- "is_skipped": 0,
- "modified": "2020-05-15 03:33:09.305991",
- "modified_by": "Administrator",
- "name": "Create a Price List",
- "owner": "Administrator",
- "reference_document": "Price List",
- "show_full_form": 1,
- "title": "Create a Price List",
- "validate_action": 1
-}
\ No newline at end of file
diff --git a/erpnext/stock/onboarding_step/create_a_purchase_receipt/create_a_purchase_receipt.json b/erpnext/stock/onboarding_step/create_a_purchase_receipt/create_a_purchase_receipt.json
new file mode 100644
index 0000000..b7811a4
--- /dev/null
+++ b/erpnext/stock/onboarding_step/create_a_purchase_receipt/create_a_purchase_receipt.json
@@ -0,0 +1,19 @@
+{
+ "action": "Create Entry",
+ "creation": "2020-05-19 18:59:13.266713",
+ "docstatus": 0,
+ "doctype": "Onboarding Step",
+ "idx": 0,
+ "is_complete": 0,
+ "is_mandatory": 0,
+ "is_single": 0,
+ "is_skipped": 0,
+ "modified": "2020-05-19 18:59:13.266713",
+ "modified_by": "Administrator",
+ "name": "Create a Purchase Receipt",
+ "owner": "Administrator",
+ "reference_document": "Purchase Receipt",
+ "show_full_form": 1,
+ "title": "Create a Purchase Receipt",
+ "validate_action": 1
+}
\ No newline at end of file
diff --git a/erpnext/stock/onboarding_step/create_a_supplier/create_a_supplier.json b/erpnext/stock/onboarding_step/create_a_supplier/create_a_supplier.json
new file mode 100644
index 0000000..7a64224
--- /dev/null
+++ b/erpnext/stock/onboarding_step/create_a_supplier/create_a_supplier.json
@@ -0,0 +1,19 @@
+{
+ "action": "Create Entry",
+ "creation": "2020-05-14 22:09:10.043554",
+ "docstatus": 0,
+ "doctype": "Onboarding Step",
+ "idx": 0,
+ "is_complete": 0,
+ "is_mandatory": 0,
+ "is_single": 0,
+ "is_skipped": 0,
+ "modified": "2020-05-14 22:09:10.043554",
+ "modified_by": "Administrator",
+ "name": "Create a Supplier",
+ "owner": "Administrator",
+ "reference_document": "Supplier",
+ "show_full_form": 0,
+ "title": "Create a Supplier",
+ "validate_action": 1
+}
\ No newline at end of file
diff --git a/erpnext/stock/onboarding_step/create_a_warehouse/create_a_warehouse.json b/erpnext/stock/onboarding_step/create_a_warehouse/create_a_warehouse.json
deleted file mode 100644
index 3269125..0000000
--- a/erpnext/stock/onboarding_step/create_a_warehouse/create_a_warehouse.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "action": "Create Entry",
- "creation": "2020-05-12 18:00:03.027704",
- "docstatus": 0,
- "doctype": "Onboarding Step",
- "idx": 0,
- "is_complete": 0,
- "is_mandatory": 0,
- "is_single": 0,
- "is_skipped": 0,
- "modified": "2020-05-12 18:27:44.128737",
- "modified_by": "Administrator",
- "name": "Create a Warehouse",
- "owner": "Administrator",
- "reference_document": "Warehouse",
- "show_full_form": 0,
- "title": "Setup your Purchase Warehouse",
- "validate_action": 1
-}
\ No newline at end of file
diff --git a/erpnext/stock/onboarding_step/introduction_to_price_list_and_item_price/introduction_to_price_list_and_item_price.json b/erpnext/stock/onboarding_step/introduction_to_price_list_and_item_price/introduction_to_price_list_and_item_price.json
deleted file mode 100644
index f75523a..0000000
--- a/erpnext/stock/onboarding_step/introduction_to_price_list_and_item_price/introduction_to_price_list_and_item_price.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "action": "Watch Video",
- "creation": "2020-05-15 03:26:01.386069",
- "docstatus": 0,
- "doctype": "Onboarding Step",
- "idx": 0,
- "is_complete": 0,
- "is_mandatory": 0,
- "is_single": 0,
- "is_skipped": 0,
- "modified": "2020-05-15 03:31:01.267728",
- "modified_by": "Administrator",
- "name": "Introduction to Price List and Item Price",
- "owner": "Administrator",
- "show_full_form": 0,
- "title": "Let's take a brief look at Price List and Item Price",
- "validate_action": 1,
- "video_url": "https://www.youtube.com/watch?v=lY6hAQM1I28"
-}
\ No newline at end of file
diff --git a/erpnext/stock/onboarding_step/introduction_to_stock_entry/introduction_to_stock_entry.json b/erpnext/stock/onboarding_step/introduction_to_stock_entry/introduction_to_stock_entry.json
index 229bcd4..447611f 100644
--- a/erpnext/stock/onboarding_step/introduction_to_stock_entry/introduction_to_stock_entry.json
+++ b/erpnext/stock/onboarding_step/introduction_to_stock_entry/introduction_to_stock_entry.json
@@ -8,12 +8,12 @@
  "is_mandatory": 0,
  "is_single": 0,
  "is_skipped": 0,
- "modified": "2020-05-15 03:30:39.606147",
+ "modified": "2020-05-19 18:55:41.457289",
  "modified_by": "Administrator",
  "name": "Introduction to Stock Entry",
  "owner": "Administrator",
  "show_full_form": 0,
- "title": "Introduction to the backbone of Stock, Stock Entry.",
+ "title": "Introduction to the multi-purpose stock transaction",
  "validate_action": 1,
  "video_url": "https://www.youtube.com/watch?v=Njt107hlY3I"
 }
\ No newline at end of file
diff --git a/erpnext/stock/onboarding_step/setup_your_warehouse/setup_your_warehouse.json b/erpnext/stock/onboarding_step/setup_your_warehouse/setup_your_warehouse.json
new file mode 100644
index 0000000..557c905
--- /dev/null
+++ b/erpnext/stock/onboarding_step/setup_your_warehouse/setup_your_warehouse.json
@@ -0,0 +1,20 @@
+{
+ "action": "Go to Page",
+ "creation": "2020-05-19 18:54:19.383397",
+ "docstatus": 0,
+ "doctype": "Onboarding Step",
+ "idx": 0,
+ "is_complete": 0,
+ "is_mandatory": 0,
+ "is_single": 0,
+ "is_skipped": 0,
+ "modified": "2020-05-19 18:54:19.383397",
+ "modified_by": "Administrator",
+ "name": "Setup your Warehouse",
+ "owner": "Administrator",
+ "path": "Tree/Warehouse",
+ "reference_document": "Warehouse",
+ "show_full_form": 0,
+ "title": "Setup your Warehouse",
+ "validate_action": 1
+}
\ No newline at end of file
diff --git a/erpnext/stock/report/delivery_note_trends/delivery_note_trends.py b/erpnext/stock/report/delivery_note_trends/delivery_note_trends.py
index 40a639b..5a931e7 100644
--- a/erpnext/stock/report/delivery_note_trends/delivery_note_trends.py
+++ b/erpnext/stock/report/delivery_note_trends/delivery_note_trends.py
@@ -40,7 +40,7 @@
 			"labels" : labels,
 			"datasets" : [
 				{
-				"name": _("Total Revenue"),
+				"name": _("Total Delivered Amount"),
 				"values": datapoints
 				}
 			]
diff --git a/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.py b/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.py
index 3b8d8d2..43f1f37 100644
--- a/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.py
+++ b/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.py
@@ -40,7 +40,7 @@
 			"labels" : labels,
 			"datasets" : [
 				{
-				"name": _("Total Expenditure"),
+				"name": _("Total Received Amount"),
 				"values": datapoints
 				}
 			]
diff --git a/erpnext/stock/report/stock_ageing/stock_ageing.py b/erpnext/stock/report/stock_ageing/stock_ageing.py
index c5b8f43..af99780 100644
--- a/erpnext/stock/report/stock_ageing/stock_ageing.py
+++ b/erpnext/stock/report/stock_ageing/stock_ageing.py
@@ -53,7 +53,7 @@
 			age_qty += batch_age * 1
 			total_qty += 1
 
-	return (age_qty / total_qty) if total_qty else 0.0
+	return flt(age_qty / total_qty, 2) if total_qty else 0.0
 
 def get_columns(filters):
 	columns = [
@@ -242,6 +242,8 @@
 	if filters.get("show_warehouse_wise_stock"):
 		return {}
 
+	data.sort(key = lambda row: row[6], reverse=True)
+
 	if len(data) > 10:
 		data = data[:10]