fix: CRM module dashboard and onboarding

This commit is contained in:
Nabin Hait 2020-05-20 12:55:34 +05:30
parent 189be3c68b
commit 7cbbd68176
8 changed files with 89 additions and 96 deletions

View File

@ -2,6 +2,7 @@
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
import frappe, erpnext, json import frappe, erpnext, json
from frappe import _
def get_data(): def get_data():
return frappe._dict({ return frappe._dict({
@ -16,19 +17,19 @@ def get_dashboards():
"name": "CRM", "name": "CRM",
"dashboard_name": "CRM", "dashboard_name": "CRM",
"charts": [ "charts": [
{ "chart": "Lead", "width": "Full" }, { "chart": "Incoming Leads", "width": "Full" },
{ "chart": "Opportunity", "width": "Full"}, { "chart": "Opportunity Trends", "width": "Full"},
{ "chart": "Campaign", "width": "Half" }, { "chart": "Won Opportunities", "width": "Full" },
{ "chart": "Opportunities Won", "width": "Half" }, { "chart": "Territory Wise Opportunity Count", "width": "Half"},
{ "chart": "Territory Wise Opportunity", "width": "Half"},
{ "chart": "Territory Wise Sales", "width": "Half"}, { "chart": "Territory Wise Sales", "width": "Half"},
{ "chart": "Qualified For Call", "width": "Full"}, { "chart": "Opportunities via Campaigns", "width": "Half" },
{ "chart": "Lead Source", "width": "Half"} { "chart": "Lead Source", "width": "Half"}
], ],
"cards": [ "cards": [
{ "card": "New Lead" }, { "card": "New Lead (Last 1 Month)" },
{ "card": "New Opportunity" }, { "card": "New Opportunity (Last 1 Month)" },
{ "card": "Won Opportunity" }, { "card": "Won Opportunity (Last 1 Month)" },
{ "card": "Open Opportunity"},
] ]
}] }]
@ -46,11 +47,11 @@ def get_charts():
company = get_company_for_dashboards() company = get_company_for_dashboards()
return [{ return [{
"name": "Lead", "name": "Incoming Leads",
"doctype": "Dashboard Chart", "doctype": "Dashboard Chart",
"time_interval": "Yearly", "time_interval": "Yearly",
"chart_type": "Count", "chart_type": "Count",
"chart_name": "Lead", "chart_name": _("Incoming Leads"),
"timespan": "Last Quarter", "timespan": "Last Quarter",
"time_interval": "Weekly", "time_interval": "Weekly",
"document_type": "Lead", "document_type": "Lead",
@ -62,11 +63,11 @@ def get_charts():
"type": "Bar" "type": "Bar"
}, },
{ {
"name": "Opportunity", "name": "Opportunity Trends",
"doctype": "Dashboard Chart", "doctype": "Dashboard Chart",
"time_interval": "Yearly", "time_interval": "Yearly",
"chart_type": "Count", "chart_type": "Count",
"chart_name": "Opportunity", "chart_name": _("Opportunity Trends"),
"timespan": "Last Quarter", "timespan": "Last Quarter",
"time_interval": "Weekly", "time_interval": "Weekly",
"document_type": "Opportunity", "document_type": "Opportunity",
@ -78,28 +79,25 @@ def get_charts():
"type": "Bar" "type": "Bar"
}, },
{ {
"name": "Campaign", "name": "Opportunities via Campaigns",
"chart_name": _("Opportunities via Campaigns"),
"doctype": "Dashboard Chart", "doctype": "Dashboard Chart",
"time_interval": "Yearly", "chart_type": "Group By",
"chart_type": "Count", "group_by_type": "Count",
"chart_name": "Campaign", "group_by_based_on": "campaign",
"timespan": "Last Year", "document_type": "Opportunity",
"time_interval": "Monthly",
"document_type": "Campaign",
"based_on": "creation",
'is_public': 1, 'is_public': 1,
'timeseries': 1, 'timeseries': 1,
"owner": "Administrator", "owner": "Administrator",
"filters_json": json.dumps([["Opportunity", "company", "=", company, False]]), "filters_json": json.dumps([["Opportunity", "company", "=", company, False]]),
"type": "Line", "type": "Pie"
"color": "#428b46"
}, },
{ {
"name": "Opportunities Won", "name": "Won Opportunities",
"doctype": "Dashboard Chart", "doctype": "Dashboard Chart",
"time_interval": "Yearly", "time_interval": "Yearly",
"chart_type": "Count", "chart_type": "Count",
"chart_name": "Opportunities Won", "chart_name": _("Won Opportunities"),
"timespan": "Last Year", "timespan": "Last Year",
"time_interval": "Monthly", "time_interval": "Monthly",
"document_type": "Opportunity", "document_type": "Opportunity",
@ -107,20 +105,25 @@ def get_charts():
'is_public': 1, 'is_public': 1,
'timeseries': 1, 'timeseries': 1,
"owner": "Administrator", "owner": "Administrator",
"filters_json": json.dumps([["Opportunity", "company", "=", company, False],["Opportunity", "sales_stage", "=", "Converted", False]]), "filters_json": json.dumps([
["Opportunity", "company", "=", company, False],
["Opportunity", "status", "=", "Converted", False]]),
"type": "Bar" "type": "Bar"
}, },
{ {
"name": "Territory Wise Opportunity", "name": "Territory Wise Opportunity Count",
"doctype": "Dashboard Chart", "doctype": "Dashboard Chart",
"chart_type": "Group By", "chart_type": "Group By",
"group_by_type": "Count", "group_by_type": "Count",
"group_by_based_on": "territory", "group_by_based_on": "territory",
"chart_name": "Territory Wise Opportunity", "chart_name": _("Territory Wise Opportunity Count"),
"document_type": "Opportunity", "document_type": "Opportunity",
'is_public': 1, 'is_public': 1,
"filters_json": json.dumps([
["Opportunity", "company", "=", company, False]
]),
"owner": "Administrator", "owner": "Administrator",
"type": "Line" "type": "Donut"
}, },
{ {
"name": "Territory Wise Sales", "name": "Territory Wise Sales",
@ -128,31 +131,16 @@ def get_charts():
"chart_type": "Group By", "chart_type": "Group By",
"group_by_type": "Sum", "group_by_type": "Sum",
"group_by_based_on": "territory", "group_by_based_on": "territory",
"chart_name": "Territory Wise Sales", "chart_name": _("Territory Wise Sales"),
"aggregate_function_based_on": "opportunity_amount", "aggregate_function_based_on": "opportunity_amount",
"document_type": "Opportunity", "document_type": "Opportunity",
'is_public': 1, 'is_public': 1,
"owner": "Administrator", "owner": "Administrator",
"filters_json": json.dumps([["Opportunity", "company", "=", company, False],["Opportunity", "sales_stage", "=", "Converted", False]]), "filters_json": json.dumps([
"type": "Bar", ["Opportunity", "company", "=", company, False],
"color": "#7575ff" ["Opportunity", "status", "=", "Converted", False]
}, ]),
{ "type": "Donut"
"name": "Qualified For Call",
"doctype": "Dashboard Chart",
"time_interval": "Yearly",
"chart_type": "Count",
"chart_name": "Qualified For Call",
"timespan": "Last Quarter",
"time_interval": "Weekly",
"document_type": "Opportunity",
"based_on": "modified",
'is_public': 1,
'timeseries': 1,
"owner": "Administrator",
"filters_json": json.dumps([["Opportunity", "company", "=", company, False],["Opportunity", "sales_stage", "=", "Qualification", False]]),
"type": "Line",
"color": "#fff168"
}, },
{ {
"name": "Lead Source", "name": "Lead Source",
@ -160,44 +148,55 @@ def get_charts():
"chart_type": "Group By", "chart_type": "Group By",
"group_by_type": "Count", "group_by_type": "Count",
"group_by_based_on": "source", "group_by_based_on": "source",
"chart_name": "Lead Source", "chart_name": _("Lead Source"),
"document_type": "Lead", "document_type": "Lead",
'is_public': 1, 'is_public': 1,
"owner": "Administrator", "owner": "Administrator",
"type": "Donut" "type": "Pie"
}] }]
def get_number_cards(): def get_number_cards():
return [{ return [{
"doctype": "Number Card", "doctype": "Number Card",
"document_type": "Lead", "document_type": "Lead",
"name": "New Lead", "name": "New Lead (Last 1 Month)",
"filters_json": json.dumps([["Lead","status","=","Lead",False]]), "filters_json": json.dumps([["Lead","creation","Previous","1 month",False]]),
"function": "Count", "function": "Count",
"is_public": 1, "is_public": 1,
"label": "New Lead", "label": _("New Lead (Last 1 Month)"),
"show_percentage_stats": 1, "show_percentage_stats": 1,
"stats_time_interval": "Daily" "stats_time_interval": "Daily"
}, },
{ {
"doctype": "Number Card", "doctype": "Number Card",
"document_type": "Opportunity", "document_type": "Opportunity",
"name": "New Opportunity", "name": "New Opportunity (Last 1 Month)",
"filters_json": json.dumps([["Opportunity","creation","Previous","1 month",False]]),
"function": "Count",
"is_public": 1,
"label": _("New Opportunity (Last 1 Month)"),
"show_percentage_stats": 1,
"stats_time_interval": "Daily"
},
{
"doctype": "Number Card",
"document_type": "Opportunity",
"name": "Won Opportunity (Last 1 Month)",
"filters_json": json.dumps([["Opportunity","creation","Previous","1 month",False]]),
"function": "Count",
"is_public": 1,
"label": _("Won Opportunity (Last 1 Month)"),
"show_percentage_stats": 1,
"stats_time_interval": "Daily"
},
{
"doctype": "Number Card",
"document_type": "Opportunity",
"name": "Open Opportunity",
"filters_json": json.dumps([["Opportunity","status","=","Open",False]]), "filters_json": json.dumps([["Opportunity","status","=","Open",False]]),
"function": "Count", "function": "Count",
"is_public": 1, "is_public": 1,
"label": "New Opportunity", "label": _("Open Opportunity"),
"show_percentage_stats": 1,
"stats_time_interval": "Daily"
},
{
"doctype": "Number Card",
"document_type": "Opportunity",
"name": "Won Opportunity",
"filters_json": json.dumps([["Opportunity","status","=","Converted",False]]),
"function": "Count",
"is_public": 1,
"label": "Won Opportunity",
"show_percentage_stats": 1, "show_percentage_stats": 1,
"stats_time_interval": "Daily" "stats_time_interval": "Daily"
}] }]

View File

@ -38,10 +38,11 @@
"docstatus": 0, "docstatus": 0,
"doctype": "Desk Page", "doctype": "Desk Page",
"extends_another_page": 0, "extends_another_page": 0,
"hide_custom": 0,
"idx": 0, "idx": 0,
"is_standard": 1, "is_standard": 1,
"label": "CRM", "label": "CRM",
"modified": "2020-05-14 17:20:07.636751", "modified": "2020-05-20 12:11:36.250491",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "CRM", "module": "CRM",
"name": "CRM", "name": "CRM",
@ -73,6 +74,11 @@
"label": "Sales Analytics", "label": "Sales Analytics",
"link_to": "Sales Analytics", "link_to": "Sales Analytics",
"type": "Report" "type": "Report"
},
{
"label": "CRM Dashboard",
"link_to": "CRM",
"type": "Dashboard"
} }
] ]
} }

View File

@ -4,10 +4,10 @@
"role": "Sales Master Manager" "role": "Sales Master Manager"
}, },
{ {
"role": "Administrator" "role": "Sales Manager"
}, },
{ {
"role": "Sales Manager" "role": "Sales User"
} }
], ],
"creation": "2020-05-09 23:42:50.901548", "creation": "2020-05-09 23:42:50.901548",
@ -16,7 +16,7 @@
"documentation_url": "https://docs.erpnext.com/docs/user/manual/en/CRM", "documentation_url": "https://docs.erpnext.com/docs/user/manual/en/CRM",
"idx": 0, "idx": 0,
"is_complete": 0, "is_complete": 0,
"modified": "2020-05-14 17:41:11.083917", "modified": "2020-05-20 12:53:47.029412",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "CRM", "module": "CRM",
"name": "CRM", "name": "CRM",
@ -25,9 +25,6 @@
{ {
"step": "Introduction to CRM" "step": "Introduction to CRM"
}, },
{
"step": "Start Campaign"
},
{ {
"step": "Create Lead" "step": "Create Lead"
}, },
@ -38,7 +35,7 @@
"step": "Create and Send Quotation" "step": "Create and Send Quotation"
} }
], ],
"subtitle": "Campaign, Lead, Opportunity, Customer and more", "subtitle": "Lead, Opportunity, Customer and more",
"success_message": "CRM Module is all setup!", "success_message": "CRM Module is all setup!",
"title": "Let's Setup Your CRM", "title": "Let's Setup Your CRM",
"user_can_dismiss": 1 "user_can_dismiss": 1

View File

@ -13,5 +13,7 @@
"name": "Create and Send Quotation", "name": "Create and Send Quotation",
"owner": "Administrator", "owner": "Administrator",
"reference_document": "Quotation", "reference_document": "Quotation",
"title": "Create and Send Quotation" "show_full_form": 0,
"title": "Create and Send Quotation",
"validate_action": 0
} }

View File

@ -13,5 +13,7 @@
"name": "Create Lead", "name": "Create Lead",
"owner": "Administrator", "owner": "Administrator",
"reference_document": "Lead", "reference_document": "Lead",
"title": "Create Lead" "show_full_form": 0,
"title": "Create Lead",
"validate_action": 0
} }

View File

@ -13,5 +13,7 @@
"name": "Create Opportunity", "name": "Create Opportunity",
"owner": "Administrator", "owner": "Administrator",
"reference_document": "Opportunity", "reference_document": "Opportunity",
"title": "Create Opportunity" "show_full_form": 0,
"title": "Create Opportunity",
"validate_action": 0
} }

View File

@ -12,6 +12,8 @@
"modified_by": "Administrator", "modified_by": "Administrator",
"name": "Introduction to CRM", "name": "Introduction to CRM",
"owner": "Administrator", "owner": "Administrator",
"show_full_form": 0,
"title": "Introduction to CRM", "title": "Introduction to CRM",
"validate_action": 0,
"video_url": "https://www.youtube.com/watch?v=o9XCSZHJfpA" "video_url": "https://www.youtube.com/watch?v=o9XCSZHJfpA"
} }

View File

@ -1,17 +0,0 @@
{
"action": "Create Entry",
"creation": "2020-05-09 23:38:10.284957",
"docstatus": 0,
"doctype": "Onboarding Step",
"idx": 0,
"is_complete": 0,
"is_mandatory": 0,
"is_single": 0,
"is_skipped": 0,
"modified": "2020-05-14 17:28:54.285958",
"modified_by": "Administrator",
"name": "Start Campaign",
"owner": "Administrator",
"reference_document": "Campaign",
"title": "Start Campaign"
}