1
0
forked from test/crm

patch: Rename Twilio Settings to CRM Twilio Settings

Move Twilio Agent to Telephony Agent
This commit is contained in:
Shariq Ansari 2025-01-19 16:13:18 +05:30
parent 89dd09325f
commit 97b67cfed5
3 changed files with 41 additions and 1 deletions

View File

@ -2,6 +2,7 @@
# 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
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]
# Patches added in this section will be executed after doctypes are migrated
@ -9,4 +10,5 @@ crm.patches.v1_0.create_email_template_custom_fields
crm.patches.v1_0.create_default_fields_layout #10/12/2024
crm.patches.v1_0.create_default_sidebar_fields_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

View 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()

View File

@ -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)