From 5d01b88a1e949f8388d8ca9f3e6ef62fe30a977a Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 30 Jun 2025 17:43:42 +0530 Subject: [PATCH] feat: created lost reason doctype --- crm/fcrm/doctype/crm_deal/crm_deal.json | 9 ++- .../crm_lead_source/crm_lead_source.json | 17 +++- crm/fcrm/doctype/crm_lost_reason/__init__.py | 0 .../crm_lost_reason/crm_lost_reason.js | 8 ++ .../crm_lost_reason/crm_lost_reason.json | 79 +++++++++++++++++++ .../crm_lost_reason/crm_lost_reason.py | 9 +++ .../crm_lost_reason/test_crm_lost_reason.py | 30 +++++++ 7 files changed, 148 insertions(+), 4 deletions(-) create mode 100644 crm/fcrm/doctype/crm_lost_reason/__init__.py create mode 100644 crm/fcrm/doctype/crm_lost_reason/crm_lost_reason.js create mode 100644 crm/fcrm/doctype/crm_lost_reason/crm_lost_reason.json create mode 100644 crm/fcrm/doctype/crm_lost_reason/crm_lost_reason.py create mode 100644 crm/fcrm/doctype/crm_lost_reason/test_crm_lost_reason.py diff --git a/crm/fcrm/doctype/crm_deal/crm_deal.json b/crm/fcrm/doctype/crm_deal/crm_deal.json index bbef186d..6344d6d9 100644 --- a/crm/fcrm/doctype/crm_deal/crm_deal.json +++ b/crm/fcrm/doctype/crm_deal/crm_deal.json @@ -14,6 +14,7 @@ "column_break_ijan", "status", "deal_owner", + "lost_reason", "section_break_jgpm", "probability", "deal_value", @@ -391,12 +392,18 @@ { "fieldname": "column_break_kpxa", "fieldtype": "Column Break" + }, + { + "fieldname": "lost_reason", + "fieldtype": "Link", + "label": "Lost Reason", + "options": "CRM Lost Reason" } ], "grid_page_length": 50, "index_web_pages_for_search": 1, "links": [], - "modified": "2025-06-16 11:42:49.413483", + "modified": "2025-06-30 17:40:28.673539", "modified_by": "Administrator", "module": "FCRM", "name": "CRM Deal", diff --git a/crm/fcrm/doctype/crm_lead_source/crm_lead_source.json b/crm/fcrm/doctype/crm_lead_source/crm_lead_source.json index 416ccd7e..87fb72f3 100644 --- a/crm/fcrm/doctype/crm_lead_source/crm_lead_source.json +++ b/crm/fcrm/doctype/crm_lead_source/crm_lead_source.json @@ -27,9 +27,10 @@ "label": "Details" } ], + "grid_page_length": 50, "index_web_pages_for_search": 1, "links": [], - "modified": "2025-01-02 22:13:30.498404", + "modified": "2025-06-30 16:53:51.721752", "modified_by": "Administrator", "module": "FCRM", "name": "CRM Lead Source", @@ -44,7 +45,7 @@ "print": 1, "read": 1, "report": 1, - "role": "Sales User", + "role": "System Manager", "share": 1, "write": 1 }, @@ -60,6 +61,15 @@ "share": 1, "write": 1 }, + { + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Sales User", + "share": 1 + }, { "email": 1, "export": 1, @@ -71,7 +81,8 @@ } ], "quick_entry": 1, + "row_format": "Dynamic", "sort_field": "modified", "sort_order": "DESC", "states": [] -} \ No newline at end of file +} diff --git a/crm/fcrm/doctype/crm_lost_reason/__init__.py b/crm/fcrm/doctype/crm_lost_reason/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/crm/fcrm/doctype/crm_lost_reason/crm_lost_reason.js b/crm/fcrm/doctype/crm_lost_reason/crm_lost_reason.js new file mode 100644 index 00000000..effd824a --- /dev/null +++ b/crm/fcrm/doctype/crm_lost_reason/crm_lost_reason.js @@ -0,0 +1,8 @@ +// Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt + +// frappe.ui.form.on("CRM Lost Reason", { +// refresh(frm) { + +// }, +// }); diff --git a/crm/fcrm/doctype/crm_lost_reason/crm_lost_reason.json b/crm/fcrm/doctype/crm_lost_reason/crm_lost_reason.json new file mode 100644 index 00000000..ce774060 --- /dev/null +++ b/crm/fcrm/doctype/crm_lost_reason/crm_lost_reason.json @@ -0,0 +1,79 @@ +{ + "actions": [], + "allow_rename": 1, + "autoname": "field:lost_reason", + "creation": "2025-06-30 16:51:31.082360", + "doctype": "DocType", + "engine": "InnoDB", + "field_order": [ + "lost_reason", + "description" + ], + "fields": [ + { + "fieldname": "lost_reason", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Lost Reason", + "reqd": 1, + "unique": 1 + }, + { + "fieldname": "description", + "fieldtype": "Text Editor", + "label": "Description" + } + ], + "grid_page_length": 50, + "index_web_pages_for_search": 1, + "links": [], + "modified": "2025-06-30 16:59:15.094049", + "modified_by": "Administrator", + "module": "FCRM", + "name": "CRM Lost Reason", + "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 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Sales Manager", + "share": 1, + "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Sales User", + "share": 1, + "write": 1 + } + ], + "quick_entry": 1, + "row_format": "Dynamic", + "sort_field": "creation", + "sort_order": "DESC", + "states": [] +} diff --git a/crm/fcrm/doctype/crm_lost_reason/crm_lost_reason.py b/crm/fcrm/doctype/crm_lost_reason/crm_lost_reason.py new file mode 100644 index 00000000..b43a399c --- /dev/null +++ b/crm/fcrm/doctype/crm_lost_reason/crm_lost_reason.py @@ -0,0 +1,9 @@ +# Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + + +class CRMLostReason(Document): + pass diff --git a/crm/fcrm/doctype/crm_lost_reason/test_crm_lost_reason.py b/crm/fcrm/doctype/crm_lost_reason/test_crm_lost_reason.py new file mode 100644 index 00000000..2f353477 --- /dev/null +++ b/crm/fcrm/doctype/crm_lost_reason/test_crm_lost_reason.py @@ -0,0 +1,30 @@ +# Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and Contributors +# See license.txt + +# import frappe +from frappe.tests import IntegrationTestCase, UnitTestCase + + +# On IntegrationTestCase, the doctype test records and all +# link-field test record dependencies are recursively loaded +# Use these module variables to add/remove to/from that list +EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] +IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] + + +class UnitTestCRMLostReason(UnitTestCase): + """ + Unit tests for CRMLostReason. + Use this class for testing individual functions and methods. + """ + + pass + + +class IntegrationTestCRMLostReason(IntegrationTestCase): + """ + Integration tests for CRMLostReason. + Use this class for testing interactions between multiple components. + """ + + pass