patch: Rename Twilio Settings to CRM Twilio Settings
Move Twilio Agent to Telephony Agent
This commit is contained in:
parent
89dd09325f
commit
97b67cfed5
@ -2,6 +2,7 @@
|
|||||||
# Patches added in this section will be executed before doctypes are migrated
|
# Patches added in this section will be executed before doctypes are migrated
|
||||||
# Read docs to understand patches: https://frappeframework.com/docs/v14/user/en/database-migrations
|
# Read docs to understand patches: https://frappeframework.com/docs/v14/user/en/database-migrations
|
||||||
crm.patches.v1_0.move_crm_note_data_to_fcrm_note
|
crm.patches.v1_0.move_crm_note_data_to_fcrm_note
|
||||||
|
crm.patches.v1_0.rename_twilio_settings_to_crm_twilio_settings
|
||||||
|
|
||||||
[post_model_sync]
|
[post_model_sync]
|
||||||
# Patches added in this section will be executed after doctypes are migrated
|
# Patches added in this section will be executed after doctypes are migrated
|
||||||
@ -10,3 +11,4 @@ crm.patches.v1_0.create_default_fields_layout #10/12/2024
|
|||||||
crm.patches.v1_0.create_default_sidebar_fields_layout
|
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
|
||||||
27
crm/patches/v1_0/move_twilio_agent_to_telephony_agent.py
Normal file
27
crm/patches/v1_0/move_twilio_agent_to_telephony_agent.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import frappe
|
||||||
|
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
if not frappe.db.exists("DocType", "CRM Telephony Agent"):
|
||||||
|
frappe.reload_doctype("CRM Telephony Agent", force=True)
|
||||||
|
|
||||||
|
if frappe.db.exists("DocType", "Twilio Agents") and frappe.db.count("Twilio Agents") == 0:
|
||||||
|
return
|
||||||
|
|
||||||
|
agents = frappe.db.sql("SELECT * FROM `tabTwilio Agents`", as_dict=True)
|
||||||
|
if agents:
|
||||||
|
for agent in agents:
|
||||||
|
doc = frappe.get_doc(
|
||||||
|
{
|
||||||
|
"doctype": "CRM Telephony Agent",
|
||||||
|
"creation": agent.get("creation"),
|
||||||
|
"modified": agent.get("modified"),
|
||||||
|
"modified_by": agent.get("modified_by"),
|
||||||
|
"owner": agent.get("owner"),
|
||||||
|
"user": agent.get("user"),
|
||||||
|
"twilio_number": agent.get("twilio_number"),
|
||||||
|
"user_name": agent.get("user_name"),
|
||||||
|
"twilio": True,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
doc.db_insert()
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
import frappe
|
||||||
|
from frappe.model.rename_doc import rename_doc
|
||||||
|
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
if frappe.db.table_exists("Twilio Settings"):
|
||||||
|
frappe.flags.ignore_route_conflict_validation = True
|
||||||
|
rename_doc("DocType", "Twilio Settings", "CRM Twilio Settings")
|
||||||
|
frappe.flags.ignore_route_conflict_validation = False
|
||||||
|
|
||||||
|
frappe.reload_doctype("CRM Twilio Settings", force=True)
|
||||||
Loading…
x
Reference in New Issue
Block a user