From 4d162cd0dd4a5fb2e0dde4e33589c80985642b1d Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Wed, 2 Jul 2025 16:57:26 +0530 Subject: [PATCH] fix: add default lost reason on install (cherry picked from commit 96cbdea8201301fd5b5c117742c7ecab83fff902) --- crm/install.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/crm/install.py b/crm/install.py index 9f8e617d..c42fc0fa 100644 --- a/crm/install.py +++ b/crm/install.py @@ -20,6 +20,7 @@ def after_install(force=False): add_email_template_custom_fields() add_default_industries() add_default_lead_sources() + add_default_lost_reasons() add_standard_dropdown_items() add_default_scripts() frappe.db.commit() @@ -351,6 +352,44 @@ def add_default_lead_sources(): doc.insert() +def add_default_lost_reasons(): + lost_reasons = [ + { + "reason": "Pricing", + "description": "The prospect found the pricing to be too high or not competitive.", + }, + {"reason": "Competition", "description": "The prospect chose a competitor's product or service."}, + { + "reason": "Budget Constraints", + "description": "The prospect did not have the budget to proceed with the purchase.", + }, + { + "reason": "Missing Features", + "description": "The prospect felt that the product or service was missing key features they needed.", + }, + { + "reason": "Long Sales Cycle", + "description": "The sales process took too long, leading to loss of interest.", + }, + { + "reason": "No Decision-Maker", + "description": "The prospect was not the decision-maker and could not proceed.", + }, + {"reason": "Unresponsive Prospect", "description": "The prospect did not respond to follow-ups."}, + {"reason": "Poor Fit", "description": "The prospect was not a good fit for the product or service."}, + {"reason": "Other", "description": ""}, + ] + + for reason in lost_reasons: + if frappe.db.exists("CRM Lost Reason", reason): + continue + + doc = frappe.new_doc("CRM Lost Reason") + doc.lost_reason = reason["reason"] + doc.description = reason["description"] + doc.insert() + + def add_standard_dropdown_items(): crm_settings = frappe.get_single("FCRM Settings")