From 637c9dd0e25a9d5d34f77de4414533be38052da7 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Thu, 4 Jan 2024 19:00:22 +0530 Subject: [PATCH 1/3] fix: create territory doctype and added in lead/deal/organization --- crm/fcrm/doctype/crm_deal/crm_deal.json | 10 +- crm/fcrm/doctype/crm_lead/crm_lead.json | 10 +- .../crm_organization/crm_organization.json | 11 +- crm/fcrm/doctype/crm_territory/__init__.py | 0 .../doctype/crm_territory/crm_territory.js | 8 ++ .../doctype/crm_territory/crm_territory.json | 113 ++++++++++++++++++ .../doctype/crm_territory/crm_territory.py | 9 ++ .../crm_territory/test_crm_territory.py | 9 ++ 8 files changed, 166 insertions(+), 4 deletions(-) create mode 100644 crm/fcrm/doctype/crm_territory/__init__.py create mode 100644 crm/fcrm/doctype/crm_territory/crm_territory.js create mode 100644 crm/fcrm/doctype/crm_territory/crm_territory.json create mode 100644 crm/fcrm/doctype/crm_territory/crm_territory.py create mode 100644 crm/fcrm/doctype/crm_territory/test_crm_territory.py diff --git a/crm/fcrm/doctype/crm_deal/crm_deal.json b/crm/fcrm/doctype/crm_deal/crm_deal.json index 6277ab23..25f521cb 100644 --- a/crm/fcrm/doctype/crm_deal/crm_deal.json +++ b/crm/fcrm/doctype/crm_deal/crm_deal.json @@ -10,6 +10,7 @@ "organization_tab", "organization", "website", + "territory", "annual_revenue", "close_date", "probability", @@ -208,11 +209,18 @@ "fieldtype": "Link", "label": "Communication Status", "options": "CRM Communication Status" + }, + { + "fetch_from": "organization.territory", + "fieldname": "territory", + "fieldtype": "Data", + "label": "Territory", + "read_only": 1 } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2023-12-28 11:40:16.934256", + "modified": "2024-01-04 18:58:55.295874", "modified_by": "Administrator", "module": "FCRM", "name": "CRM Deal", diff --git a/crm/fcrm/doctype/crm_lead/crm_lead.json b/crm/fcrm/doctype/crm_lead/crm_lead.json index be950405..70569d62 100644 --- a/crm/fcrm/doctype/crm_lead/crm_lead.json +++ b/crm/fcrm/doctype/crm_lead/crm_lead.json @@ -12,6 +12,7 @@ "details", "organization", "website", + "territory", "industry", "job_title", "source", @@ -270,12 +271,19 @@ "fieldtype": "Link", "label": "Communication Status", "options": "CRM Communication Status" + }, + { + "fetch_from": "organization.territory", + "fieldname": "territory", + "fieldtype": "Data", + "label": "Territory", + "read_only": 1 } ], "image_field": "image", "index_web_pages_for_search": 1, "links": [], - "modified": "2023-12-28 11:39:47.573673", + "modified": "2024-01-04 18:58:26.603817", "modified_by": "Administrator", "module": "FCRM", "name": "CRM Lead", diff --git a/crm/fcrm/doctype/crm_organization/crm_organization.json b/crm/fcrm/doctype/crm_organization/crm_organization.json index b2eb2bd7..1b300b94 100644 --- a/crm/fcrm/doctype/crm_organization/crm_organization.json +++ b/crm/fcrm/doctype/crm_organization/crm_organization.json @@ -9,10 +9,11 @@ "field_order": [ "organization_name", "no_of_employees", + "annual_revenue", "organization_logo", "column_break_pnpp", "website", - "annual_revenue", + "territory", "industry" ], "fields": [ @@ -53,12 +54,18 @@ "fieldtype": "Link", "label": "Industry", "options": "CRM Industry" + }, + { + "fieldname": "territory", + "fieldtype": "Link", + "label": "Territory", + "options": "CRM Territory" } ], "image_field": "organization_logo", "index_web_pages_for_search": 1, "links": [], - "modified": "2023-11-23 13:11:37.301082", + "modified": "2024-01-04 18:57:52.519305", "modified_by": "Administrator", "module": "FCRM", "name": "CRM Organization", diff --git a/crm/fcrm/doctype/crm_territory/__init__.py b/crm/fcrm/doctype/crm_territory/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/crm/fcrm/doctype/crm_territory/crm_territory.js b/crm/fcrm/doctype/crm_territory/crm_territory.js new file mode 100644 index 00000000..568e9c4c --- /dev/null +++ b/crm/fcrm/doctype/crm_territory/crm_territory.js @@ -0,0 +1,8 @@ +// Copyright (c) 2024, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt + +// frappe.ui.form.on("CRM Territory", { +// refresh(frm) { + +// }, +// }); diff --git a/crm/fcrm/doctype/crm_territory/crm_territory.json b/crm/fcrm/doctype/crm_territory/crm_territory.json new file mode 100644 index 00000000..60b6b43f --- /dev/null +++ b/crm/fcrm/doctype/crm_territory/crm_territory.json @@ -0,0 +1,113 @@ +{ + "actions": [], + "allow_rename": 1, + "creation": "2024-01-04 18:52:58.872535", + "doctype": "DocType", + "engine": "InnoDB", + "field_order": [ + "territory_name", + "column_break_mckp", + "territory_manager", + "section_break_qhaf", + "old_parent", + "parent_crm_territory", + "is_group", + "column_break_pypy", + "lft", + "rgt" + ], + "fields": [ + { + "fieldname": "territory_name", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Territory Name", + "reqd": 1 + }, + { + "default": "0", + "fieldname": "is_group", + "fieldtype": "Check", + "label": "Is Group" + }, + { + "fieldname": "column_break_pypy", + "fieldtype": "Column Break" + }, + { + "fieldname": "territory_manager", + "fieldtype": "Link", + "label": "Territory Manager", + "options": "User" + }, + { + "fieldname": "lft", + "fieldtype": "Int", + "hidden": 1, + "label": "Left", + "no_copy": 1, + "read_only": 1 + }, + { + "fieldname": "rgt", + "fieldtype": "Int", + "hidden": 1, + "label": "Right", + "no_copy": 1, + "read_only": 1 + }, + { + "default": "0", + "fieldname": "is_group", + "fieldtype": "Check", + "label": "Is Group" + }, + { + "fieldname": "old_parent", + "fieldtype": "Link", + "label": "Old Parent", + "options": "CRM Territory" + }, + { + "fieldname": "parent_crm_territory", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Parent CRM Territory", + "options": "CRM Territory" + }, + { + "fieldname": "column_break_mckp", + "fieldtype": "Column Break" + }, + { + "fieldname": "section_break_qhaf", + "fieldtype": "Section Break" + } + ], + "index_web_pages_for_search": 1, + "is_tree": 1, + "links": [], + "modified": "2024-01-04 18:56:49.292276", + "modified_by": "Administrator", + "module": "FCRM", + "name": "CRM Territory", + "nsm_parent_field": "parent_crm_territory", + "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_territory/crm_territory.py b/crm/fcrm/doctype/crm_territory/crm_territory.py new file mode 100644 index 00000000..d08f3bee --- /dev/null +++ b/crm/fcrm/doctype/crm_territory/crm_territory.py @@ -0,0 +1,9 @@ +# Copyright (c) 2024, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + + +class CRMTerritory(Document): + pass diff --git a/crm/fcrm/doctype/crm_territory/test_crm_territory.py b/crm/fcrm/doctype/crm_territory/test_crm_territory.py new file mode 100644 index 00000000..475707fd --- /dev/null +++ b/crm/fcrm/doctype/crm_territory/test_crm_territory.py @@ -0,0 +1,9 @@ +# Copyright (c) 2024, Frappe Technologies Pvt. Ltd. and Contributors +# See license.txt + +# import frappe +from frappe.tests.utils import FrappeTestCase + + +class TestCRMTerritory(FrappeTestCase): + pass From ebf9b4074686e4cc0c0434c457f7c8e1ca7fb8a2 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Thu, 4 Jan 2024 19:09:49 +0530 Subject: [PATCH 2/3] fix: added territories & assignment rule shortcut on workspace --- crm/fcrm/workspace/frappe_crm/frappe_crm.json | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/crm/fcrm/workspace/frappe_crm/frappe_crm.json b/crm/fcrm/workspace/frappe_crm/frappe_crm.json index f7e4c319..543e49a8 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}},{\"id\":\"v1kkMwlntf\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"SLA\",\"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}},{\"id\":\"ApHOcISpiJ\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Communication Statuses\",\"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\":\"v1kkMwlntf\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"SLA\",\"col\":3}},{\"id\":\"WRzt4SMh_b\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Assignment Rule\",\"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}},{\"id\":\"arT4xZ9HWR\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Territories\",\"col\":3}},{\"id\":\"ApHOcISpiJ\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Communication Statuses\",\"col\":3}}]", "creation": "2023-11-27 13:55:17.090361", "custom_blocks": [], "docstatus": 0, @@ -13,7 +13,7 @@ "is_hidden": 0, "label": "Frappe CRM", "links": [], - "modified": "2023-12-13 19:59:33.129412", + "modified": "2024-01-04 19:08:27.799960", "modified_by": "Administrator", "module": "FCRM", "name": "Frappe CRM", @@ -64,6 +64,22 @@ "stats_filter": "[]", "type": "DocType" }, + { + "color": "Grey", + "doc_view": "Tree", + "label": "Territories", + "link_to": "CRM Territory", + "stats_filter": "[]", + "type": "DocType" + }, + { + "color": "Grey", + "doc_view": "List", + "label": "Assignment Rule", + "link_to": "Assignment Rule", + "stats_filter": "[]", + "type": "DocType" + }, { "color": "Grey", "doc_view": "List", From c3c18ca11949bf70c0bb6e3f073949bcf2f7ef31 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Thu, 4 Jan 2024 19:31:17 +0530 Subject: [PATCH 3/3] fix: added territory field in organization page --- .../doctype/crm_territory/crm_territory.json | 7 +++-- .../src/components/Icons/TerritoryIcon.vue | 21 ++++++++++++++ .../components/Modals/OrganizationModal.vue | 15 ++++++++++ frontend/src/pages/Contact.vue | 11 ++------ frontend/src/pages/Organization.vue | 28 ++++++++++++------- 5 files changed, 62 insertions(+), 20 deletions(-) create mode 100644 frontend/src/components/Icons/TerritoryIcon.vue diff --git a/crm/fcrm/doctype/crm_territory/crm_territory.json b/crm/fcrm/doctype/crm_territory/crm_territory.json index 60b6b43f..bf7449bf 100644 --- a/crm/fcrm/doctype/crm_territory/crm_territory.json +++ b/crm/fcrm/doctype/crm_territory/crm_territory.json @@ -1,6 +1,7 @@ { "actions": [], "allow_rename": 1, + "autoname": "field:territory_name", "creation": "2024-01-04 18:52:58.872535", "doctype": "DocType", "engine": "InnoDB", @@ -22,7 +23,8 @@ "fieldtype": "Data", "in_list_view": 1, "label": "Territory Name", - "reqd": 1 + "reqd": 1, + "unique": 1 }, { "default": "0", @@ -87,10 +89,11 @@ "index_web_pages_for_search": 1, "is_tree": 1, "links": [], - "modified": "2024-01-04 18:56:49.292276", + "modified": "2024-01-04 19:16:36.234887", "modified_by": "Administrator", "module": "FCRM", "name": "CRM Territory", + "naming_rule": "By fieldname", "nsm_parent_field": "parent_crm_territory", "owner": "Administrator", "permissions": [ diff --git a/frontend/src/components/Icons/TerritoryIcon.vue b/frontend/src/components/Icons/TerritoryIcon.vue new file mode 100644 index 00000000..90c7075c --- /dev/null +++ b/frontend/src/components/Icons/TerritoryIcon.vue @@ -0,0 +1,21 @@ + diff --git a/frontend/src/components/Modals/OrganizationModal.vue b/frontend/src/components/Modals/OrganizationModal.vue index 78a02245..0bfdab0f 100644 --- a/frontend/src/components/Modals/OrganizationModal.vue +++ b/frontend/src/components/Modals/OrganizationModal.vue @@ -66,6 +66,15 @@ placeholder="Add Annual Revenue" /> +
{ name: 'website', value: _organization.value.website, }, + { + icon: TerritoryIcon, + name: 'territory', + value: _organization.value.territory, + }, { icon: h(FeatherIcon, { name: 'dollar-sign', class: 'h-4 w-4' }), name: 'annual_revenue', diff --git a/frontend/src/pages/Contact.vue b/frontend/src/pages/Contact.vue index b43e083e..d3a12d45 100644 --- a/frontend/src/pages/Contact.vue +++ b/frontend/src/pages/Contact.vue @@ -65,7 +65,7 @@ {{ contact.email_id }}
· @@ -80,10 +80,7 @@ {{ contact.mobile_no }} · @@ -102,9 +99,7 @@ {{ contact.company_name }} · diff --git a/frontend/src/pages/Organization.vue b/frontend/src/pages/Organization.vue index a9dd3208..49e2e3a7 100644 --- a/frontend/src/pages/Organization.vue +++ b/frontend/src/pages/Organization.vue @@ -66,7 +66,7 @@ {{ website(organization.website) }} · @@ -79,10 +79,20 @@ {{ organization.industry }} + · + +
+ + {{ organization.territory }} +
+ · @@ -95,11 +105,7 @@ {{ organization.annual_revenue }} · @@ -108,6 +114,7 @@ v-if=" organization.website || organization.industry || + organization.territory || organization.annual_revenue " variant="ghost" @@ -243,6 +250,7 @@ import LeadsListView from '@/components/ListViews/LeadsListView.vue' import DealsListView from '@/components/ListViews/DealsListView.vue' import ContactsListView from '@/components/ListViews/ContactsListView.vue' import WebsiteIcon from '@/components/Icons/WebsiteIcon.vue' +import TerritoryIcon from '@/components/Icons/TerritoryIcon.vue' import EditIcon from '@/components/Icons/EditIcon.vue' import CameraIcon from '@/components/Icons/CameraIcon.vue' import LeadsIcon from '@/components/Icons/LeadsIcon.vue'