fix: add default probabilities in deal status
(cherry picked from commit 6d3268a61ecd96710f2c7d1cede33a5cc6f939d6)
This commit is contained in:
parent
76b5a2d7bb
commit
29132f6f23
@ -37,13 +37,14 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "probability",
|
"fieldname": "probability",
|
||||||
"fieldtype": "Percent",
|
"fieldtype": "Percent",
|
||||||
|
"in_list_view": 1,
|
||||||
"label": "Probability"
|
"label": "Probability"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"grid_page_length": 50,
|
"grid_page_length": 50,
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2025-06-11 13:00:34.518808",
|
"modified": "2025-07-01 12:06:42.937440",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "FCRM",
|
"module": "FCRM",
|
||||||
"name": "CRM Deal Status",
|
"name": "CRM Deal Status",
|
||||||
|
|||||||
@ -68,26 +68,32 @@ def add_default_deal_statuses():
|
|||||||
statuses = {
|
statuses = {
|
||||||
"Qualification": {
|
"Qualification": {
|
||||||
"color": "gray",
|
"color": "gray",
|
||||||
|
"probability": 10,
|
||||||
"position": 1,
|
"position": 1,
|
||||||
},
|
},
|
||||||
"Demo/Making": {
|
"Demo/Making": {
|
||||||
"color": "orange",
|
"color": "orange",
|
||||||
|
"probability": 25,
|
||||||
"position": 2,
|
"position": 2,
|
||||||
},
|
},
|
||||||
"Proposal/Quotation": {
|
"Proposal/Quotation": {
|
||||||
"color": "blue",
|
"color": "blue",
|
||||||
|
"probability": 50,
|
||||||
"position": 3,
|
"position": 3,
|
||||||
},
|
},
|
||||||
"Negotiation": {
|
"Negotiation": {
|
||||||
"color": "yellow",
|
"color": "yellow",
|
||||||
|
"probability": 70,
|
||||||
"position": 4,
|
"position": 4,
|
||||||
},
|
},
|
||||||
"Ready to Close": {
|
"Ready to Close": {
|
||||||
"color": "purple",
|
"color": "purple",
|
||||||
|
"probability": 90,
|
||||||
"position": 5,
|
"position": 5,
|
||||||
},
|
},
|
||||||
"Won": {
|
"Won": {
|
||||||
"color": "green",
|
"color": "green",
|
||||||
|
"probability": 100,
|
||||||
"position": 6,
|
"position": 6,
|
||||||
},
|
},
|
||||||
"Lost": {
|
"Lost": {
|
||||||
@ -103,6 +109,7 @@ def add_default_deal_statuses():
|
|||||||
doc = frappe.new_doc("CRM Deal Status")
|
doc = frappe.new_doc("CRM Deal Status")
|
||||||
doc.deal_status = status
|
doc.deal_status = status
|
||||||
doc.color = statuses[status]["color"]
|
doc.color = statuses[status]["color"]
|
||||||
|
doc.probability = statuses[status]["probability"]
|
||||||
doc.position = statuses[status]["position"]
|
doc.position = statuses[status]["position"]
|
||||||
doc.insert()
|
doc.insert()
|
||||||
|
|
||||||
|
|||||||
@ -12,4 +12,5 @@ crm.patches.v1_0.create_default_sidebar_fields_layout
|
|||||||
crm.patches.v1_0.update_deal_quick_entry_layout
|
crm.patches.v1_0.update_deal_quick_entry_layout
|
||||||
crm.patches.v1_0.update_layouts_to_new_format
|
crm.patches.v1_0.update_layouts_to_new_format
|
||||||
crm.patches.v1_0.move_twilio_agent_to_telephony_agent
|
crm.patches.v1_0.move_twilio_agent_to_telephony_agent
|
||||||
crm.patches.v1_0.create_default_scripts # 13-06-2025
|
crm.patches.v1_0.create_default_scripts # 13-06-2025
|
||||||
|
crm.patches.v1_0.update_deal_status_probabilities
|
||||||
24
crm/patches/v1_0/update_deal_status_probabilities.py
Normal file
24
crm/patches/v1_0/update_deal_status_probabilities.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import frappe
|
||||||
|
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
deal_statuses = frappe.get_all("CRM Deal Status", fields=["name", "probability", "deal_status"])
|
||||||
|
|
||||||
|
for status in deal_statuses:
|
||||||
|
if status.probability is None or status.probability == 0:
|
||||||
|
if status.deal_status == "Qualification":
|
||||||
|
probability = 10
|
||||||
|
elif status.deal_status == "Demo/Making":
|
||||||
|
probability = 25
|
||||||
|
elif status.deal_status == "Proposal/Quotation":
|
||||||
|
probability = 50
|
||||||
|
elif status.deal_status == "Negotiation":
|
||||||
|
probability = 70
|
||||||
|
elif status.deal_status == "Ready to Close":
|
||||||
|
probability = 90
|
||||||
|
elif status.deal_status == "Won":
|
||||||
|
probability = 100
|
||||||
|
else:
|
||||||
|
probability = 0
|
||||||
|
|
||||||
|
frappe.db.set_value("CRM Deal Status", status.name, "probability", probability)
|
||||||
Loading…
x
Reference in New Issue
Block a user