From c3652b38ebb89c20764c223ae6ef80054adbdb6b Mon Sep 17 00:00:00 2001 From: Abraham Kalungi <85731451+kalungia@users.noreply.github.com> Date: Mon, 1 Jul 2024 10:50:16 +0200 Subject: [PATCH 1/2] add: defaults for industry and lead source --- crm/install.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/crm/install.py b/crm/install.py index cd36f1f6..bf38d556 100644 --- a/crm/install.py +++ b/crm/install.py @@ -16,6 +16,8 @@ def after_install(): add_default_fields_layout() add_property_setter() add_email_template_custom_fields() + add_default_industries() + add_default_lead_sources() frappe.db.commit() def add_default_lead_statuses(): @@ -196,3 +198,28 @@ def add_email_template_custom_fields(): ) frappe.clear_cache(doctype="Email Template") + + +def add_default_industries(): + industries = ["Accounting", "Advertising", "Aerospace", "Agriculture", "Airline", "Apparel & Accessories", "Automotive", "Banking", "Biotechnology", "Broadcasting", "Brokerage", "Chemical", "Computer", "Consulting", "Consumer Products", "Cosmetics", "Defense", "Department Stores", "Education", "Electronics", "Energy", "Entertainment & Leisure, Executive Search", "Financial Services", "Food", "Beverage & Tobacco", "Grocery", "Health Care", "Internet Publishing", "Investment Banking", "Legal", "Manufacturing", "Motion Picture & Video", "Music", "Newspaper Publishers", "Online Auctions", "Pension Funds", "Pharmaceuticals", "Private Equity", "Publishing", "Real Estate", "Retail & Wholesale", "Securities & Commodity Exchanges", "Service", "Soap & Detergent", "Software", "Sports", "Technology", "Telecommunications", "Television", "Transportation", "Venture Capital"] + + for rec in industries: + if frappe.db.exists("CRM Industry", rec): + continue + + doc = frappe.new_doc("CRM Industry") + doc.industry = rec + doc.insert() + + +def add_default_lead_sources(): + + lead_sources = ["Existing Customer", "Reference", "Advertisement", "Cold Calling", "Exhibition", "Supplier Reference", "Mass Mailing", "Customer's Vendor", "Campaign", "Walk In"] + + for source in lead_sources: + if frappe.db.exists("CRM Lead Source", source): + continue + + doc = frappe.new_doc("CRM Lead Source") + doc.source_name = source + doc.insert() From 026650a6eb4bc574daaa48bf2a205d4709056e5a Mon Sep 17 00:00:00 2001 From: Shariq Ansari <30859809+shariquerik@users.noreply.github.com> Date: Mon, 1 Jul 2024 18:20:43 +0530 Subject: [PATCH 2/2] chore: better variable name --- crm/install.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crm/install.py b/crm/install.py index bf38d556..1cbdb66d 100644 --- a/crm/install.py +++ b/crm/install.py @@ -203,12 +203,12 @@ def add_email_template_custom_fields(): def add_default_industries(): industries = ["Accounting", "Advertising", "Aerospace", "Agriculture", "Airline", "Apparel & Accessories", "Automotive", "Banking", "Biotechnology", "Broadcasting", "Brokerage", "Chemical", "Computer", "Consulting", "Consumer Products", "Cosmetics", "Defense", "Department Stores", "Education", "Electronics", "Energy", "Entertainment & Leisure, Executive Search", "Financial Services", "Food", "Beverage & Tobacco", "Grocery", "Health Care", "Internet Publishing", "Investment Banking", "Legal", "Manufacturing", "Motion Picture & Video", "Music", "Newspaper Publishers", "Online Auctions", "Pension Funds", "Pharmaceuticals", "Private Equity", "Publishing", "Real Estate", "Retail & Wholesale", "Securities & Commodity Exchanges", "Service", "Soap & Detergent", "Software", "Sports", "Technology", "Telecommunications", "Television", "Transportation", "Venture Capital"] - for rec in industries: - if frappe.db.exists("CRM Industry", rec): + for industry in industries: + if frappe.db.exists("CRM Industry", industry): continue doc = frappe.new_doc("CRM Industry") - doc.industry = rec + doc.industry = industry doc.insert()