refactor: renamed exotel agent to telephony agent
will maintain agents details for twilio and exotel
This commit is contained in:
parent
1af60281ad
commit
bc5c53e652
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and contributors
|
// Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
// For license information, please see license.txt
|
// For license information, please see license.txt
|
||||||
|
|
||||||
// frappe.ui.form.on("CRM Exotel Agent", {
|
// frappe.ui.form.on("CRM Telephony Agent", {
|
||||||
// refresh(frm) {
|
// refresh(frm) {
|
||||||
|
|
||||||
// },
|
// },
|
||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"actions": [],
|
"actions": [],
|
||||||
"allow_rename": 1,
|
"allow_rename": 1,
|
||||||
"autoname": "field:mobile_no",
|
"autoname": "field:user",
|
||||||
"creation": "2025-01-11 16:12:46.602782",
|
"creation": "2025-01-11 16:12:46.602782",
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"engine": "InnoDB",
|
"engine": "InnoDB",
|
||||||
@ -10,7 +10,14 @@
|
|||||||
"user_name",
|
"user_name",
|
||||||
"column_break_hdec",
|
"column_break_hdec",
|
||||||
"mobile_no",
|
"mobile_no",
|
||||||
"exotel_number"
|
"section_break_ozjn",
|
||||||
|
"twilio",
|
||||||
|
"twilio_number",
|
||||||
|
"column_break_aydj",
|
||||||
|
"exotel",
|
||||||
|
"exotel_number",
|
||||||
|
"section_break_phlq",
|
||||||
|
"phone_nos"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
@ -20,7 +27,8 @@
|
|||||||
"in_standard_filter": 1,
|
"in_standard_filter": 1,
|
||||||
"label": "User",
|
"label": "User",
|
||||||
"options": "User",
|
"options": "User",
|
||||||
"reqd": 1
|
"reqd": 1,
|
||||||
|
"unique": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "column_break_hdec",
|
"fieldname": "column_break_hdec",
|
||||||
@ -32,8 +40,7 @@
|
|||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"in_standard_filter": 1,
|
"in_standard_filter": 1,
|
||||||
"label": "Mobile No.",
|
"label": "Mobile No.",
|
||||||
"reqd": 1,
|
"read_only": 1
|
||||||
"unique": 1
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fetch_from": "user.full_name",
|
"fetch_from": "user.full_name",
|
||||||
@ -44,19 +51,56 @@
|
|||||||
"label": "User Name"
|
"label": "User Name"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"depends_on": "exotel",
|
||||||
"fieldname": "exotel_number",
|
"fieldname": "exotel_number",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"in_list_view": 1,
|
"label": "Exotel Number",
|
||||||
"in_standard_filter": 1,
|
"mandatory_depends_on": "exotel"
|
||||||
"label": "Exotel Number"
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "section_break_phlq",
|
||||||
|
"fieldtype": "Section Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "section_break_ozjn",
|
||||||
|
"fieldtype": "Section Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "column_break_aydj",
|
||||||
|
"fieldtype": "Column Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"depends_on": "twilio",
|
||||||
|
"fieldname": "twilio_number",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"label": "Twilio Number",
|
||||||
|
"mandatory_depends_on": "twilio"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "phone_nos",
|
||||||
|
"fieldtype": "Table",
|
||||||
|
"label": "Phone Numbers",
|
||||||
|
"options": "CRM Telephony Phone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"fieldname": "twilio",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Twilio"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"fieldname": "exotel",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Exotel"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2025-01-15 20:03:31.162162",
|
"modified": "2025-01-19 14:12:51.596987",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "FCRM",
|
"module": "FCRM",
|
||||||
"name": "CRM Exotel Agent",
|
"name": "CRM Telephony Agent",
|
||||||
"naming_rule": "By fieldname",
|
"naming_rule": "By fieldname",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
34
crm/fcrm/doctype/crm_telephony_agent/crm_telephony_agent.py
Normal file
34
crm/fcrm/doctype/crm_telephony_agent/crm_telephony_agent.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
|
# For license information, please see license.txt
|
||||||
|
|
||||||
|
import frappe
|
||||||
|
from frappe import _
|
||||||
|
from frappe.model.document import Document
|
||||||
|
|
||||||
|
|
||||||
|
class CRMTelephonyAgent(Document):
|
||||||
|
def validate(self):
|
||||||
|
self.set_primary()
|
||||||
|
|
||||||
|
def set_primary(self):
|
||||||
|
# Used to set primary mobile no.
|
||||||
|
if len(self.phone_nos) == 0:
|
||||||
|
self.mobile_no = ""
|
||||||
|
return
|
||||||
|
|
||||||
|
is_primary = [phone.number for phone in self.phone_nos if phone.get("is_primary")]
|
||||||
|
|
||||||
|
if len(is_primary) > 1:
|
||||||
|
frappe.throw(
|
||||||
|
_("Only one {0} can be set as primary.").format(frappe.bold(frappe.unscrub("mobile_no")))
|
||||||
|
)
|
||||||
|
|
||||||
|
primary_number_exists = False
|
||||||
|
for d in self.phone_nos:
|
||||||
|
if d.get("is_primary") == 1:
|
||||||
|
primary_number_exists = True
|
||||||
|
self.mobile_no = d.number
|
||||||
|
break
|
||||||
|
|
||||||
|
if not primary_number_exists:
|
||||||
|
self.mobile_no = ""
|
||||||
@ -4,7 +4,6 @@
|
|||||||
# import frappe
|
# import frappe
|
||||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||||
|
|
||||||
|
|
||||||
# On IntegrationTestCase, the doctype test records and all
|
# On IntegrationTestCase, the doctype test records and all
|
||||||
# link-field test record dependencies are recursively loaded
|
# link-field test record dependencies are recursively loaded
|
||||||
# Use these module variables to add/remove to/from that list
|
# Use these module variables to add/remove to/from that list
|
||||||
@ -12,18 +11,18 @@ EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"]
|
|||||||
IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"]
|
IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"]
|
||||||
|
|
||||||
|
|
||||||
class UnitTestCRMExotelAgent(UnitTestCase):
|
class UnitTestCRMTelephonyAgent(UnitTestCase):
|
||||||
"""
|
"""
|
||||||
Unit tests for CRMExotelAgent.
|
Unit tests for CRMTelephonyAgent.
|
||||||
Use this class for testing individual functions and methods.
|
Use this class for testing individual functions and methods.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class IntegrationTestCRMExotelAgent(IntegrationTestCase):
|
class IntegrationTestCRMTelephonyAgent(IntegrationTestCase):
|
||||||
"""
|
"""
|
||||||
Integration tests for CRMExotelAgent.
|
Integration tests for CRMTelephonyAgent.
|
||||||
Use this class for testing interactions between multiple components.
|
Use this class for testing interactions between multiple components.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
0
crm/fcrm/doctype/crm_telephony_phone/__init__.py
Normal file
0
crm/fcrm/doctype/crm_telephony_phone/__init__.py
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
"actions": [],
|
||||||
|
"allow_rename": 1,
|
||||||
|
"creation": "2025-01-19 13:57:01.702519",
|
||||||
|
"doctype": "DocType",
|
||||||
|
"editable_grid": 1,
|
||||||
|
"engine": "InnoDB",
|
||||||
|
"field_order": [
|
||||||
|
"number",
|
||||||
|
"is_primary"
|
||||||
|
],
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldname": "number",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"in_list_view": 1,
|
||||||
|
"label": "Number",
|
||||||
|
"reqd": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"fieldname": "is_primary",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"in_list_view": 1,
|
||||||
|
"label": "Is Primary"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"index_web_pages_for_search": 1,
|
||||||
|
"istable": 1,
|
||||||
|
"links": [],
|
||||||
|
"modified": "2025-01-19 13:58:59.063775",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "FCRM",
|
||||||
|
"name": "CRM Telephony Phone",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"permissions": [],
|
||||||
|
"sort_field": "creation",
|
||||||
|
"sort_order": "DESC",
|
||||||
|
"states": []
|
||||||
|
}
|
||||||
@ -5,5 +5,5 @@
|
|||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
|
||||||
|
|
||||||
class CRMExotelAgent(Document):
|
class CRMTelephonyPhone(Document):
|
||||||
pass
|
pass
|
||||||
Loading…
x
Reference in New Issue
Block a user