diff --git a/crm/fcrm/doctype/crm_deal/crm_deal.json b/crm/fcrm/doctype/crm_deal/crm_deal.json index cefe2e2e..4cf453ea 100644 --- a/crm/fcrm/doctype/crm_deal/crm_deal.json +++ b/crm/fcrm/doctype/crm_deal/crm_deal.json @@ -111,10 +111,10 @@ { "default": "Qualification", "fieldname": "status", - "fieldtype": "Select", + "fieldtype": "Link", "in_list_view": 1, "label": "Status", - "options": "Qualification\nDemo/Making\nProposal/Quotation\nNegotiation\nReady to Close\nWon\nLost", + "options": "CRM Deal Status", "reqd": 1, "search_index": 1 }, @@ -138,7 +138,7 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2023-11-24 16:50:07.177125", + "modified": "2023-11-29 11:31:46.968519", "modified_by": "Administrator", "module": "FCRM", "name": "CRM Deal", diff --git a/crm/fcrm/doctype/crm_deal_status/__init__.py b/crm/fcrm/doctype/crm_deal_status/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/crm/fcrm/doctype/crm_deal_status/crm_deal_status.js b/crm/fcrm/doctype/crm_deal_status/crm_deal_status.js new file mode 100644 index 00000000..5033645f --- /dev/null +++ b/crm/fcrm/doctype/crm_deal_status/crm_deal_status.js @@ -0,0 +1,8 @@ +// Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt + +// frappe.ui.form.on("CRM Deal Status", { +// refresh(frm) { + +// }, +// }); diff --git a/crm/fcrm/doctype/crm_deal_status/crm_deal_status.json b/crm/fcrm/doctype/crm_deal_status/crm_deal_status.json new file mode 100644 index 00000000..d683bf68 --- /dev/null +++ b/crm/fcrm/doctype/crm_deal_status/crm_deal_status.json @@ -0,0 +1,62 @@ +{ + "actions": [], + "allow_rename": 1, + "autoname": "field:deal_status", + "creation": "2023-11-29 11:24:55.543387", + "doctype": "DocType", + "engine": "InnoDB", + "field_order": [ + "deal_status", + "color", + "position" + ], + "fields": [ + { + "default": "gray", + "fieldname": "color", + "fieldtype": "Select", + "in_list_view": 1, + "label": "Color", + "options": "black\ngray\nblue\ngreen\nred\npink\norange\namber\nyellow\ncyan\nteal\nviolet\npurple" + }, + { + "fieldname": "deal_status", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Status", + "reqd": 1, + "unique": 1 + }, + { + "fieldname": "position", + "fieldtype": "Int", + "in_list_view": 1, + "label": "Position" + } + ], + "index_web_pages_for_search": 1, + "links": [], + "modified": "2023-11-29 12:52:03.070218", + "modified_by": "Administrator", + "module": "FCRM", + "name": "CRM Deal Status", + "naming_rule": "By fieldname", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "states": [] +} \ No newline at end of file diff --git a/crm/fcrm/doctype/crm_deal_status/crm_deal_status.py b/crm/fcrm/doctype/crm_deal_status/crm_deal_status.py new file mode 100644 index 00000000..4386d698 --- /dev/null +++ b/crm/fcrm/doctype/crm_deal_status/crm_deal_status.py @@ -0,0 +1,9 @@ +# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + + +class CRMDealStatus(Document): + pass diff --git a/crm/fcrm/doctype/crm_deal_status/test_crm_deal_status.py b/crm/fcrm/doctype/crm_deal_status/test_crm_deal_status.py new file mode 100644 index 00000000..b5463dc1 --- /dev/null +++ b/crm/fcrm/doctype/crm_deal_status/test_crm_deal_status.py @@ -0,0 +1,9 @@ +# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and Contributors +# See license.txt + +# import frappe +from frappe.tests.utils import FrappeTestCase + + +class TestCRMDealStatus(FrappeTestCase): + pass diff --git a/crm/fcrm/doctype/crm_lead/crm_lead.json b/crm/fcrm/doctype/crm_lead/crm_lead.json index 8a60704d..300f9901 100644 --- a/crm/fcrm/doctype/crm_lead/crm_lead.json +++ b/crm/fcrm/doctype/crm_lead/crm_lead.json @@ -74,10 +74,10 @@ { "default": "Open", "fieldname": "status", - "fieldtype": "Select", + "fieldtype": "Link", "in_list_view": 1, "label": "Status", - "options": "Open\nContacted\nNurture\nQualified\nUnqualified\nJunk", + "options": "CRM Lead Status", "reqd": 1, "search_index": 1 }, @@ -201,7 +201,7 @@ "image_field": "image", "index_web_pages_for_search": 1, "links": [], - "modified": "2023-11-24 16:38:36.695965", + "modified": "2023-11-29 11:31:08.555096", "modified_by": "Administrator", "module": "FCRM", "name": "CRM Lead", diff --git a/crm/fcrm/doctype/crm_lead_status/__init__.py b/crm/fcrm/doctype/crm_lead_status/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/crm/fcrm/doctype/crm_lead_status/crm_lead_status.js b/crm/fcrm/doctype/crm_lead_status/crm_lead_status.js new file mode 100644 index 00000000..24b63188 --- /dev/null +++ b/crm/fcrm/doctype/crm_lead_status/crm_lead_status.js @@ -0,0 +1,8 @@ +// Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt + +// frappe.ui.form.on("CRM Lead Status", { +// refresh(frm) { + +// }, +// }); diff --git a/crm/fcrm/doctype/crm_lead_status/crm_lead_status.json b/crm/fcrm/doctype/crm_lead_status/crm_lead_status.json new file mode 100644 index 00000000..a13281ba --- /dev/null +++ b/crm/fcrm/doctype/crm_lead_status/crm_lead_status.json @@ -0,0 +1,63 @@ +{ + "actions": [], + "allow_rename": 1, + "autoname": "field:lead_status", + "creation": "2023-11-29 11:09:53.678414", + "doctype": "DocType", + "engine": "InnoDB", + "field_order": [ + "lead_status", + "color", + "position" + ], + "fields": [ + { + "default": "gray", + "fieldname": "color", + "fieldtype": "Select", + "in_list_view": 1, + "label": "Color", + "options": "black\ngray\nblue\ngreen\nred\npink\norange\namber\nyellow\ncyan\nteal\nviolet\npurple" + }, + { + "fieldname": "lead_status", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Status", + "reqd": 1, + "unique": 1 + }, + { + "default": "1", + "fieldname": "position", + "fieldtype": "Int", + "in_list_view": 1, + "label": "Position" + } + ], + "index_web_pages_for_search": 1, + "links": [], + "modified": "2023-11-29 12:52:25.641581", + "modified_by": "Administrator", + "module": "FCRM", + "name": "CRM Lead Status", + "naming_rule": "By fieldname", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "states": [] +} \ No newline at end of file diff --git a/crm/fcrm/doctype/crm_lead_status/crm_lead_status.py b/crm/fcrm/doctype/crm_lead_status/crm_lead_status.py new file mode 100644 index 00000000..d4c8a332 --- /dev/null +++ b/crm/fcrm/doctype/crm_lead_status/crm_lead_status.py @@ -0,0 +1,9 @@ +# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + + +class CRMLeadStatus(Document): + pass diff --git a/crm/fcrm/doctype/crm_lead_status/test_crm_lead_status.py b/crm/fcrm/doctype/crm_lead_status/test_crm_lead_status.py new file mode 100644 index 00000000..9cb24fd4 --- /dev/null +++ b/crm/fcrm/doctype/crm_lead_status/test_crm_lead_status.py @@ -0,0 +1,9 @@ +# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and Contributors +# See license.txt + +# import frappe +from frappe.tests.utils import FrappeTestCase + + +class TestCRMLeadStatus(FrappeTestCase): + pass diff --git a/crm/fcrm/workspace/frappe_crm/frappe_crm.json b/crm/fcrm/workspace/frappe_crm/frappe_crm.json index 2b9b2a05..6c56ef5a 100644 --- a/crm/fcrm/workspace/frappe_crm/frappe_crm.json +++ b/crm/fcrm/workspace/frappe_crm/frappe_crm.json @@ -1,6 +1,6 @@ { "charts": [], - "content": "[{\"id\":\"1nr6UkvDiL\",\"type\":\"header\",\"data\":{\"text\":\"PORTAL\",\"col\":12}},{\"id\":\"1hyi8SysUY\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"CRM Portal Page\",\"col\":3}},{\"id\":\"ktENiGaqXQ\",\"type\":\"spacer\",\"data\":{\"col\":12}},{\"id\":\"VgeWLYOuAS\",\"type\":\"paragraph\",\"data\":{\"text\":\"SHORTCUTS\",\"col\":12}},{\"id\":\"A66FpG-K3T\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Leads\",\"col\":3}},{\"id\":\"n9b6N5ebOj\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Deals\",\"col\":3}},{\"id\":\"sGHTXrludH\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Organizations\",\"col\":3}},{\"id\":\"uXZNCdqxy0\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Contacts\",\"col\":3}}]", + "content": "[{\"id\":\"1nr6UkvDiL\",\"type\":\"header\",\"data\":{\"text\":\"PORTAL\",\"col\":12}},{\"id\":\"1hyi8SysUY\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"CRM Portal Page\",\"col\":3}},{\"id\":\"ktENiGaqXQ\",\"type\":\"spacer\",\"data\":{\"col\":12}},{\"id\":\"VgeWLYOuAS\",\"type\":\"paragraph\",\"data\":{\"text\":\"SHORTCUTS\",\"col\":12}},{\"id\":\"A66FpG-K3T\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Leads\",\"col\":3}},{\"id\":\"n9b6N5ebOj\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Deals\",\"col\":3}},{\"id\":\"sGHTXrludH\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Organizations\",\"col\":3}},{\"id\":\"uXZNCdqxy0\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Contacts\",\"col\":3}},{\"id\":\"TZ7cULX3Tk\",\"type\":\"spacer\",\"data\":{\"col\":12}},{\"id\":\"zpySv0nGVQ\",\"type\":\"paragraph\",\"data\":{\"text\":\"META\",\"col\":12}},{\"id\":\"fa-uKzobpp\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Lead Statuses\",\"col\":3}},{\"id\":\"hxoZghUHP2\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Deal Statuses\",\"col\":3}},{\"id\":\"HbgghUpc8N\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Lead Sources\",\"col\":3}},{\"id\":\"8cPs7Fohb4\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Industries\",\"col\":3}}]", "creation": "2023-11-27 13:55:17.090361", "custom_blocks": [], "docstatus": 0, @@ -13,8 +13,8 @@ "is_hidden": 0, "label": "Frappe CRM", "links": [], - "modified": "2023-11-27 14:29:01.217327", - "modified_by": "shariq@frappe.io", + "modified": "2023-11-29 13:37:56.731645", + "modified_by": "Administrator", "module": "FCRM", "name": "Frappe CRM", "number_cards": [], @@ -40,6 +40,14 @@ "type": "URL", "url": "/crm" }, + { + "color": "Grey", + "doc_view": "List", + "label": "Lead Statuses", + "link_to": "CRM Lead Status", + "stats_filter": "[]", + "type": "DocType" + }, { "color": "Grey", "doc_view": "List", @@ -48,6 +56,22 @@ "stats_filter": "[]", "type": "DocType" }, + { + "color": "Grey", + "doc_view": "List", + "label": "Deal Statuses", + "link_to": "CRM Deal Status", + "stats_filter": "[]", + "type": "DocType" + }, + { + "color": "Grey", + "doc_view": "List", + "label": "Lead Sources", + "link_to": "CRM Lead Source", + "stats_filter": "[]", + "type": "DocType" + }, { "color": "Grey", "doc_view": "List", @@ -63,6 +87,14 @@ "link_to": "Contact", "stats_filter": "[]", "type": "DocType" + }, + { + "color": "Grey", + "doc_view": "List", + "label": "Industries", + "link_to": "CRM Industry", + "stats_filter": "[]", + "type": "DocType" } ], "title": "Frappe CRM" diff --git a/crm/hooks.py b/crm/hooks.py index abfc9d0e..c8e6be06 100644 --- a/crm/hooks.py +++ b/crm/hooks.py @@ -70,8 +70,8 @@ website_route_rules = [ # Installation # ------------ -# before_install = "crm.install.before_install" -# after_install = "crm.install.after_install" +before_install = "crm.install.before_install" +after_install = "crm.install.after_install" # Uninstallation # ------------ diff --git a/crm/install.py b/crm/install.py new file mode 100644 index 00000000..77979f73 --- /dev/null +++ b/crm/install.py @@ -0,0 +1,93 @@ +# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors +# MIT License. See license.txt + +from __future__ import unicode_literals +import frappe + +def before_install(): + pass + +def after_install(): + add_default_lead_statuses() + add_default_deal_statuses() + frappe.db.commit() + +def add_default_lead_statuses(): + statuses = { + "Open": { + "color": "gray", + "position": 1, + }, + "Contacted": { + "color": "orange", + "position": 2, + }, + "Nurture": { + "color": "blue", + "position": 3, + }, + "Qualified": { + "color": "green", + "position": 4, + }, + "Unqualified": { + "color": "red", + "position": 5, + }, + "Junk": { + "color": "purple", + "position": 6, + }, + } + + for status in statuses: + if frappe.db.exists("CRM Lead Status", status): + continue + + doc = frappe.new_doc("CRM Lead Status") + doc.lead_status = status + doc.color = statuses[status]["color"] + doc.position = statuses[status]["position"] + doc.insert() + +def add_default_deal_statuses(): + statuses = { + "Qualification": { + "color": "gray", + "position": 1, + }, + "Demo/Making": { + "color": "orange", + "position": 2, + }, + "Proposal/Quotation": { + "color": "blue", + "position": 3, + }, + "Negotiation": { + "color": "yellow", + "position": 4, + }, + "Ready to Close": { + "color": "purple", + "position": 5, + }, + "Won": { + "color": "green", + "position": 6, + }, + "Lost": { + "color": "red", + "position": 7, + }, + } + + for status in statuses: + if frappe.db.exists("CRM Deal Status", status): + continue + + doc = frappe.new_doc("CRM Deal Status") + doc.deal_status = status + doc.color = statuses[status]["color"] + doc.position = statuses[status]["position"] + doc.insert() \ No newline at end of file diff --git a/frontend/src/components/NewDeal.vue b/frontend/src/components/NewDeal.vue index b31baaf8..b9d3b324 100644 --- a/frontend/src/components/NewDeal.vue +++ b/frontend/src/components/NewDeal.vue @@ -11,7 +11,7 @@ v-model="newDeal[field.name]" >