Export Project dashboard (#22782)

This commit is contained in:
Anupam Kumar 2020-07-23 11:07:56 +05:30 committed by GitHub
parent 03c9cc0921
commit 4a5fc23d5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 50 deletions

View File

@ -0,0 +1,24 @@
{
"chart_name": "Project Summary",
"chart_type": "Report",
"creation": "2020-07-20 20:17:16.363681",
"custom_options": "{\"type\": \"bar\", \"colors\": [\"#fc4f51\", \"#78d6ff\", \"#7575ff\"], \"axisOptions\": { \"shortenYAxisNumbers\": 1}, \"barOptions\": { \"stacked\": 1 }}",
"docstatus": 0,
"doctype": "Dashboard Chart",
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\"}",
"filters_json": "{\"status\":\"Open\"}",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"modified": "2020-07-22 17:16:39.627076",
"modified_by": "Administrator",
"module": "Projects",
"name": "Project Summary",
"number_of_groups": 0,
"owner": "Administrator",
"report_name": "Project Summary",
"timeseries": 0,
"type": "Bar",
"use_report_chart": 1,
"y_axis": []
}

View File

@ -1,50 +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 _
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
def get_data():
return frappe._dict({
"dashboards": get_dashboards(),
"charts": get_charts(),
})
def get_dashboards():
return [{
"doctype": "Dashboard",
"name": "Project",
"dashboard_name": "Project",
"charts": [
{ "chart": "Project Summary", "width": "Full" }
]
}]
def get_charts():
company = frappe.get_doc("Company", get_company_for_dashboards())
return [
{
'doctype': 'Dashboard Chart',
'name': 'Project Summary',
'chart_name': _('Project Summary'),
'chart_type': 'Report',
'report_name': 'Project Summary',
'is_public': 1,
'is_custom': 1,
'filters_json': json.dumps({"company": company.name, "status": "Open"}),
'type': 'Bar',
'custom_options': '{"type": "bar", "colors": ["#fc4f51", "#78d6ff", "#7575ff"], "axisOptions": { "shortenYAxisNumbers": 1}, "barOptions": { "stacked": 1 }}',
}
]

View File

@ -0,0 +1,21 @@
{
"cards": [],
"charts": [
{
"chart": "Project Summary",
"width": "Full"
}
],
"creation": "2020-07-20 20:17:16.397373",
"dashboard_name": "Project",
"docstatus": 0,
"doctype": "Dashboard",
"idx": 0,
"is_default": 0,
"is_standard": 1,
"modified": "2020-07-22 17:17:03.780625",
"modified_by": "Administrator",
"module": "Projects",
"name": "Project",
"owner": "Administrator"
}