From ba4ffdac8687508aa489220d61cd86f28b5067f8 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 14 Jul 2025 18:28:51 +0530 Subject: [PATCH] fix: add default Manager Dashboard on install (cherry picked from commit 6e3d23a8e1cb2b6c4c1933a9cfa2d6fb04dd6c4c) --- crm/install.py | 10 ++++++++++ frontend/src/components/Dashboard/DashboardItem.vue | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/crm/install.py b/crm/install.py index 1b401db2..202ee21d 100644 --- a/crm/install.py +++ b/crm/install.py @@ -23,6 +23,7 @@ def after_install(force=False): add_default_lost_reasons() add_standard_dropdown_items() add_default_scripts() + add_default_manager_dashboard() frappe.db.commit() @@ -419,3 +420,12 @@ def add_default_scripts(): for doctype in ["CRM Lead", "CRM Deal"]: create_product_details_script(doctype) create_forecasting_script() + + +def add_default_manager_dashboard(): + if frappe.db.exists("CRM Dashboard", "Manager Dashboard"): + return + + doc = frappe.new_doc("CRM Dashboard") + doc.title = "Manager Dashboard" + doc.layout = '[{"name": "total_leads", "type": "number_chart", "tooltip": "Total number of leads", "layout": {"x": 0, "y": 0, "w": 4, "h": 2, "i": "total_leads"}}, {"name": "ongoing_deals", "type": "number_chart", "tooltip": "Total number of ongoing deals", "layout": {"x": 4, "y": 0, "w": 4, "h": 2, "i": "ongoing_deals"}}, {"name": "average_ongoing_deal_value", "type": "number_chart", "tooltip": "Average value of ongoing deals", "layout": {"x": 8, "y": 0, "w": 4, "h": 2, "i": "average_ongoing_deal_value"}}, {"name": "won_deals", "type": "number_chart", "tooltip": "Total number of won deals", "layout": {"x": 12, "y": 0, "w": 4, "h": 2, "i": "won_deals"}}, {"name": "average_won_deal_value", "type": "number_chart", "tooltip": "Average value of won deals", "layout": {"x": 16, "y": 0, "w": 4, "h": 2, "i": "average_won_deal_value"}}, {"name": "average_deal_value", "type": "number_chart", "tooltip": "Average deal value of ongoing and won deals", "layout": {"x": 0, "y": 2, "w": 4, "h": 2, "i": "average_deal_value"}}, {"name": "average_time_to_close_a_lead", "type": "number_chart", "tooltip": "Average time taken to close a lead", "layout": {"x": 4, "y": 2, "w": 4, "h": 2, "i": "average_time_to_close_a_lead"}}, {"name": "average_time_to_close_a_deal", "type": "number_chart", "layout": {"x": 8, "y": 2, "w": 4, "h": 2, "i": "average_time_to_close_a_deal"}}, {"name": "blank_card", "type": "blank_card", "layout": {"x": 12, "y": 2, "w": 8, "h": 2, "i": "blank_card"}}, {"name": "sales_trend", "type": "axis_chart", "layout": {"x": 0, "y": 4, "w": 10, "h": 7, "i": "sales_trend"}}, {"name": "forecasted_revenue", "type": "axis_chart", "layout": {"x": 10, "y": 4, "w": 10, "h": 7, "i": "forecasted_revenue"}}, {"name": "funnel_conversion", "type": "axis_chart", "layout": {"x": 0, "y": 11, "w": 10, "h": 7, "i": "funnel_conversion"}}, {"name": "deals_by_stage_axis", "type": "axis_chart", "layout": {"x": 10, "y": 11, "w": 10, "h": 7, "i": "deals_by_stage_axis"}}, {"name": "deals_by_stage_donut", "type": "donut_chart", "layout": {"x": 0, "y": 18, "w": 10, "h": 7, "i": "deals_by_stage_donut"}}, {"name": "lost_deal_reasons", "type": "axis_chart", "layout": {"x": 10, "y": 18, "w": 10, "h": 7, "i": "lost_deal_reasons"}}, {"name": "leads_by_source", "type": "donut_chart", "layout": {"x": 0, "y": 25, "w": 10, "h": 7, "i": "leads_by_source"}}, {"name": "deals_by_source", "type": "donut_chart", "layout": {"x": 10, "y": 25, "w": 10, "h": 7, "i": "deals_by_source"}}, {"name": "deals_by_territory", "type": "axis_chart", "layout": {"x": 0, "y": 32, "w": 10, "h": 7, "i": "deals_by_territory"}}, {"name": "deals_by_salesperson", "type": "axis_chart", "layout": {"x": 10, "y": 32, "w": 10, "h": 7, "i": "deals_by_salesperson"}}]' diff --git a/frontend/src/components/Dashboard/DashboardItem.vue b/frontend/src/components/Dashboard/DashboardItem.vue index 6afaa085..9784dc56 100644 --- a/frontend/src/components/Dashboard/DashboardItem.vue +++ b/frontend/src/components/Dashboard/DashboardItem.vue @@ -4,7 +4,7 @@ v-if="item.type == 'number_chart'" class="rounded shadow overflow-hidden cursor-pointer" > - +