feat: Export Selling Dashboard (#22776)
* feat:Export Stock Dashboard * Export Selling Dashboard * Export Selling Dashboard
This commit is contained in:
parent
c7eadfceb0
commit
93afbe143b
@ -0,0 +1,24 @@
|
||||
{
|
||||
"chart_name": "Item-wise Annual Sales",
|
||||
"chart_type": "Report",
|
||||
"creation": "2020-07-20 20:17:16.474566",
|
||||
"custom_options": "",
|
||||
"docstatus": 0,
|
||||
"doctype": "Dashboard Chart",
|
||||
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"to_date\":\"frappe.datetime.nowdate()\"}",
|
||||
"filters_json": "{\"from_date\":\"2020-06-22\"}",
|
||||
"idx": 0,
|
||||
"is_public": 1,
|
||||
"is_standard": 1,
|
||||
"modified": "2020-07-22 14:42:25.512675",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Item-wise Annual Sales",
|
||||
"number_of_groups": 0,
|
||||
"owner": "Administrator",
|
||||
"report_name": "Item-wise Sales History",
|
||||
"timeseries": 0,
|
||||
"type": "Bar",
|
||||
"use_report_chart": 1,
|
||||
"y_axis": []
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
{
|
||||
"chart_name": "Sales Order Analysis",
|
||||
"chart_type": "Report",
|
||||
"creation": "2020-07-20 20:17:16.440393",
|
||||
"custom_options": "{\"type\": \"donut\", \"height\": 300, \"axisOptions\": {\"shortenYAxisNumbers\": 1}}",
|
||||
"docstatus": 0,
|
||||
"doctype": "Dashboard Chart",
|
||||
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"to_date\":\"frappe.datetime.nowdate()\"}",
|
||||
"filters_json": "{\"status\":[\"To Bill\",\"To Deliver\"],\"group_by_so\":0,\"from_date\":\"2020-06-22\"}",
|
||||
"idx": 0,
|
||||
"is_public": 1,
|
||||
"is_standard": 1,
|
||||
"modified": "2020-07-22 17:06:05.750660",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Sales Order Analysis",
|
||||
"number_of_groups": 0,
|
||||
"owner": "Administrator",
|
||||
"report_name": "Sales Order Analysis",
|
||||
"timeseries": 0,
|
||||
"type": "Donut",
|
||||
"use_report_chart": 1,
|
||||
"y_axis": []
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
{
|
||||
"chart_name": "Sales Order Trends",
|
||||
"chart_type": "Report",
|
||||
"creation": "2020-07-20 20:17:16.508240",
|
||||
"custom_options": "{\"type\": \"line\", \"axisOptions\": {\"shortenYAxisNumbers\": 1}, \"tooltipOptions\": {}, \"lineOptions\": {\"regionFill\": 1}}",
|
||||
"docstatus": 0,
|
||||
"doctype": "Dashboard Chart",
|
||||
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"fiscal_year\":\"frappe.sys_defaults.fiscal_year\"}",
|
||||
"filters_json": "{\"period\":\"Monthly\",\"based_on\":\"Item\"}",
|
||||
"idx": 0,
|
||||
"is_public": 1,
|
||||
"is_standard": 1,
|
||||
"modified": "2020-07-22 16:24:45.726270",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Sales Order Trends",
|
||||
"number_of_groups": 0,
|
||||
"owner": "Administrator",
|
||||
"report_name": "Sales Order Trends",
|
||||
"timeseries": 0,
|
||||
"type": "Line",
|
||||
"use_report_chart": 1,
|
||||
"y_axis": []
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
{
|
||||
"chart_name": "Top Customers",
|
||||
"chart_type": "Report",
|
||||
"creation": "2020-07-20 20:17:16.539281",
|
||||
"custom_options": "",
|
||||
"docstatus": 0,
|
||||
"doctype": "Dashboard Chart",
|
||||
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"fiscal_year\":\"frappe.sys_defaults.fiscal_year\"}",
|
||||
"filters_json": "{\"period\":\"Yearly\",\"based_on\":\"Customer\"}",
|
||||
"idx": 0,
|
||||
"is_public": 1,
|
||||
"is_standard": 1,
|
||||
"modified": "2020-07-22 17:03:10.320147",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Top Customers",
|
||||
"number_of_groups": 0,
|
||||
"owner": "Administrator",
|
||||
"report_name": "Delivery Note Trends",
|
||||
"timeseries": 0,
|
||||
"type": "Bar",
|
||||
"use_report_chart": 1,
|
||||
"y_axis": []
|
||||
}
|
@ -1,198 +0,0 @@
|
||||
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
import frappe
|
||||
import json
|
||||
from frappe import _
|
||||
from frappe.utils import nowdate
|
||||
from erpnext.accounts.utils import get_fiscal_year
|
||||
|
||||
def get_data():
|
||||
return frappe._dict({
|
||||
"dashboards": get_dashboards(),
|
||||
"charts": get_charts(),
|
||||
"number_cards": get_number_cards(),
|
||||
})
|
||||
|
||||
def get_company_for_dashboards():
|
||||
company = frappe.defaults.get_defaults().company
|
||||
if company:
|
||||
return company
|
||||
else:
|
||||
company_list = frappe.get_list("Company")
|
||||
if company_list:
|
||||
return company_list[0].name
|
||||
return None
|
||||
|
||||
company = frappe.get_doc("Company", get_company_for_dashboards())
|
||||
fiscal_year = get_fiscal_year(nowdate(), as_dict=1)
|
||||
fiscal_year_name = fiscal_year.get("name")
|
||||
start_date = str(fiscal_year.get("year_start_date"))
|
||||
end_date = str(fiscal_year.get("year_end_date"))
|
||||
|
||||
def get_dashboards():
|
||||
return [{
|
||||
"name": "Selling",
|
||||
"dashboard_name": "Selling",
|
||||
"charts": [
|
||||
{ "chart": "Sales Order Trends", "width": "Full"},
|
||||
{ "chart": "Top Customers", "width": "Half"},
|
||||
{ "chart": "Sales Order Analysis", "width": "Half"},
|
||||
{ "chart": "Item-wise Annual Sales", "width": "Full"}
|
||||
],
|
||||
"cards": [
|
||||
{ "card": "Annual Sales"},
|
||||
{ "card": "Sales Orders to Deliver"},
|
||||
{ "card": "Sales Orders to Bill"},
|
||||
{ "card": "Active Customers"}
|
||||
]
|
||||
}]
|
||||
|
||||
def get_charts():
|
||||
return [
|
||||
{
|
||||
"name": "Sales Order Analysis",
|
||||
"chart_name": _("Sales Order Analysis"),
|
||||
"chart_type": "Report",
|
||||
"custom_options": json.dumps({
|
||||
"type": "donut",
|
||||
"height": 300,
|
||||
"axisOptions": {"shortenYAxisNumbers": 1}
|
||||
}),
|
||||
"doctype": "Dashboard Chart",
|
||||
"filters_json": json.dumps({
|
||||
"company": company.name,
|
||||
"from_date": start_date,
|
||||
"to_date": end_date
|
||||
}),
|
||||
"is_custom": 1,
|
||||
"is_public": 1,
|
||||
"owner": "Administrator",
|
||||
"report_name": "Sales Order Analysis",
|
||||
"type": "Donut"
|
||||
},
|
||||
{
|
||||
"name": "Item-wise Annual Sales",
|
||||
"chart_name": _("Item-wise Annual Sales"),
|
||||
"chart_type": "Report",
|
||||
"doctype": "Dashboard Chart",
|
||||
"filters_json": json.dumps({
|
||||
"company": company.name,
|
||||
"from_date": start_date,
|
||||
"to_date": end_date
|
||||
}),
|
||||
"is_custom": 1,
|
||||
"is_public": 1,
|
||||
"owner": "Administrator",
|
||||
"report_name": "Item-wise Sales History",
|
||||
"type": "Bar"
|
||||
},
|
||||
{
|
||||
"name": "Sales Order Trends",
|
||||
"chart_name": _("Sales Order Trends"),
|
||||
"chart_type": "Report",
|
||||
"custom_options": json.dumps({
|
||||
"type": "line",
|
||||
"axisOptions": {"shortenYAxisNumbers": 1},
|
||||
"tooltipOptions": {},
|
||||
"lineOptions": {
|
||||
"regionFill": 1
|
||||
}
|
||||
}),
|
||||
"doctype": "Dashboard Chart",
|
||||
"filters_json": json.dumps({
|
||||
"company": company.name,
|
||||
"period": "Monthly",
|
||||
"fiscal_year": fiscal_year_name,
|
||||
"based_on": "Item"
|
||||
}),
|
||||
"is_custom": 1,
|
||||
"is_public": 1,
|
||||
"owner": "Administrator",
|
||||
"report_name": "Sales Order Trends",
|
||||
"type": "Line"
|
||||
},
|
||||
{
|
||||
"name": "Top Customers",
|
||||
"chart_name": _("Top Customers"),
|
||||
"chart_type": "Report",
|
||||
"doctype": "Dashboard Chart",
|
||||
"filters_json": json.dumps({
|
||||
"company": company.name,
|
||||
"period": "Monthly",
|
||||
"fiscal_year": fiscal_year_name,
|
||||
"based_on": "Customer"
|
||||
}),
|
||||
"is_custom": 1,
|
||||
"is_public": 1,
|
||||
"owner": "Administrator",
|
||||
"report_name": "Delivery Note Trends",
|
||||
"type": "Bar"
|
||||
}
|
||||
]
|
||||
|
||||
def get_number_cards():
|
||||
return [
|
||||
{
|
||||
"name": "Annual Sales",
|
||||
"aggregate_function_based_on": "base_net_total",
|
||||
"doctype": "Number Card",
|
||||
"document_type": "Sales Order",
|
||||
"filters_json": json.dumps([
|
||||
["Sales Order", "transaction_date", "Between", [start_date, end_date], False],
|
||||
["Sales Order", "status", "not in", ["Draft", "Cancelled", "Closed", None], False],
|
||||
["Sales Order", "docstatus", "=", 1, False],
|
||||
["Sales Order", "company", "=", company.name, False]
|
||||
]),
|
||||
"function": "Sum",
|
||||
"is_public": 1,
|
||||
"label": _("Annual Sales"),
|
||||
"owner": "Administrator",
|
||||
"show_percentage_stats": 1,
|
||||
"stats_time_interval": "Monthly"
|
||||
},
|
||||
{
|
||||
"name": "Sales Orders to Deliver",
|
||||
"doctype": "Number Card",
|
||||
"document_type": "Sales Order",
|
||||
"filters_json": json.dumps([
|
||||
["Sales Order", "status", "in", ["To Deliver and Bill", "To Deliver", None], False],
|
||||
["Sales Order", "docstatus", "=", 1, False],
|
||||
["Sales Order", "company", "=", company.name, False]
|
||||
]),
|
||||
"function": "Count",
|
||||
"is_public": 1,
|
||||
"label": _("Sales Orders to Deliver"),
|
||||
"owner": "Administrator",
|
||||
"show_percentage_stats": 1,
|
||||
"stats_time_interval": "Weekly"
|
||||
},
|
||||
{
|
||||
"name": "Sales Orders to Bill",
|
||||
"doctype": "Number Card",
|
||||
"document_type": "Sales Order",
|
||||
"filters_json": json.dumps([
|
||||
["Sales Order", "status", "in", ["To Deliver and Bill", "To Bill", None], False],
|
||||
["Sales Order", "docstatus", "=", 1, False],
|
||||
["Sales Order", "company", "=", company.name, False]
|
||||
]),
|
||||
"function": "Count",
|
||||
"is_public": 1,
|
||||
"label": _("Sales Orders to Bill"),
|
||||
"owner": "Administrator",
|
||||
"show_percentage_stats": 1,
|
||||
"stats_time_interval": "Weekly"
|
||||
},
|
||||
{
|
||||
"name": "Active Customers",
|
||||
"doctype": "Number Card",
|
||||
"document_type": "Customer",
|
||||
"filters_json": json.dumps([["Customer", "disabled", "=", "0"]]),
|
||||
"function": "Count",
|
||||
"is_public": 1,
|
||||
"label": "Active Customers",
|
||||
"owner": "Administrator",
|
||||
"show_percentage_stats": 1,
|
||||
"stats_time_interval": "Monthly"
|
||||
}
|
||||
]
|
@ -0,0 +1,21 @@
|
||||
{
|
||||
"creation": "2020-07-20 20:17:16.653866",
|
||||
"docstatus": 0,
|
||||
"doctype": "Number Card",
|
||||
"document_type": "Customer",
|
||||
"dynamic_filters_json": "",
|
||||
"filters_json": "[[\"Customer\",\"disabled\",\"=\",\"0\"]]",
|
||||
"function": "Count",
|
||||
"idx": 0,
|
||||
"is_public": 1,
|
||||
"is_standard": 1,
|
||||
"label": "Active Customers",
|
||||
"modified": "2020-07-22 14:20:32.268103",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Active Customers",
|
||||
"owner": "Administrator",
|
||||
"show_percentage_stats": 1,
|
||||
"stats_time_interval": "Monthly",
|
||||
"type": "Document Type"
|
||||
}
|
22
erpnext/selling/number_card/annual_sales/annual_sales.json
Normal file
22
erpnext/selling/number_card/annual_sales/annual_sales.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"aggregate_function_based_on": "base_net_total",
|
||||
"creation": "2020-07-20 20:17:16.568132",
|
||||
"docstatus": 0,
|
||||
"doctype": "Number Card",
|
||||
"document_type": "Sales Order",
|
||||
"dynamic_filters_json": "[[\"Sales Order\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
|
||||
"filters_json": "[[\"Sales Order\",\"status\",\"not in\",[\"Draft\",\"Cancelled\",\"Closed\",null],false],[\"Sales Order\",\"docstatus\",\"=\",\"1\",false],[\"Sales Order\",\"modified\",\"Timespan\",\"this year\",false]]",
|
||||
"function": "Sum",
|
||||
"idx": 0,
|
||||
"is_public": 1,
|
||||
"is_standard": 1,
|
||||
"label": "Annual Sales",
|
||||
"modified": "2020-07-22 16:56:33.747156",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Annual Sales",
|
||||
"owner": "Administrator",
|
||||
"show_percentage_stats": 1,
|
||||
"stats_time_interval": "Monthly",
|
||||
"type": "Document Type"
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
{
|
||||
"creation": "2020-07-20 20:17:16.625001",
|
||||
"docstatus": 0,
|
||||
"doctype": "Number Card",
|
||||
"document_type": "Sales Order",
|
||||
"dynamic_filters_json": "[[\"Sales Order\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
|
||||
"filters_json": "[[\"Sales Order\",\"status\",\"in\",[\"To Deliver and Bill\",\"To Bill\",null],false],[\"Sales Order\",\"docstatus\",\"=\",\"1\",false]]",
|
||||
"function": "Count",
|
||||
"idx": 0,
|
||||
"is_public": 1,
|
||||
"is_standard": 1,
|
||||
"label": "Sales Orders to Bill",
|
||||
"modified": "2020-07-22 14:20:09.918626",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Sales Orders to Bill",
|
||||
"owner": "Administrator",
|
||||
"show_percentage_stats": 1,
|
||||
"stats_time_interval": "Weekly",
|
||||
"type": "Document Type"
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
{
|
||||
"creation": "2020-07-20 20:17:16.596857",
|
||||
"docstatus": 0,
|
||||
"doctype": "Number Card",
|
||||
"document_type": "Sales Order",
|
||||
"dynamic_filters_json": "[[\"Sales Order\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
|
||||
"filters_json": "[[\"Sales Order\",\"status\",\"in\",[\"To Deliver and Bill\",\"To Deliver\",null],false],[\"Sales Order\",\"docstatus\",\"=\",\"1\",false]]",
|
||||
"function": "Count",
|
||||
"idx": 0,
|
||||
"is_public": 1,
|
||||
"is_standard": 1,
|
||||
"label": "Sales Orders to Deliver",
|
||||
"modified": "2020-07-22 14:19:28.833784",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Sales Orders to Deliver",
|
||||
"owner": "Administrator",
|
||||
"show_percentage_stats": 1,
|
||||
"stats_time_interval": "Weekly",
|
||||
"type": "Document Type"
|
||||
}
|
46
erpnext/selling/selling_dashboard/selling/selling.json
Normal file
46
erpnext/selling/selling_dashboard/selling/selling.json
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"cards": [
|
||||
{
|
||||
"card": "Annual Sales"
|
||||
},
|
||||
{
|
||||
"card": "Sales Orders to Deliver"
|
||||
},
|
||||
{
|
||||
"card": "Sales Orders to Bill"
|
||||
},
|
||||
{
|
||||
"card": "Active Customers"
|
||||
}
|
||||
],
|
||||
"charts": [
|
||||
{
|
||||
"chart": "Sales Order Trends",
|
||||
"width": "Full"
|
||||
},
|
||||
{
|
||||
"chart": "Top Customers",
|
||||
"width": "Half"
|
||||
},
|
||||
{
|
||||
"chart": "Sales Order Analysis",
|
||||
"width": "Half"
|
||||
},
|
||||
{
|
||||
"chart": "Item-wise Annual Sales",
|
||||
"width": "Full"
|
||||
}
|
||||
],
|
||||
"creation": "2020-07-20 20:17:16.688162",
|
||||
"dashboard_name": "Selling",
|
||||
"docstatus": 0,
|
||||
"doctype": "Dashboard",
|
||||
"idx": 0,
|
||||
"is_default": 0,
|
||||
"is_standard": 1,
|
||||
"modified": "2020-07-22 15:31:22.299903",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Selling",
|
||||
"owner": "Administrator"
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user