fix: add default lead/deal status on app install
This commit is contained in:
parent
dd87502829
commit
3735148991
@ -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
|
||||
# ------------
|
||||
|
||||
93
crm/install.py
Normal file
93
crm/install.py
Normal file
@ -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()
|
||||
Loading…
x
Reference in New Issue
Block a user