fix: call type doctype, fixes

This commit is contained in:
Subin Tom 2022-02-25 16:52:25 +05:30
parent 00b0f10100
commit 5b79496f05
9 changed files with 105 additions and 22 deletions

View File

@ -34,14 +34,14 @@ def handle_end_call(**kwargs):
@frappe.whitelist(allow_guest=True)
def handle_missed_call(**kwargs):
status = ""
CallType = kwargs.get("CallType")
DialCallStatus = kwargs.get("DialCallStatus")
call_type = kwargs.get("CallType")
dial_call_status = kwargs.get("DialCallStatus")
if CallType == "incomplete" and DialCallStatus == "no-answer":
if call_type == "incomplete" and dial_call_status == "no-answer":
status = 'No Answer'
elif CallType == "client-hangup" and DialCallStatus == "canceled":
elif call_type == "client-hangup" and dial_call_status == "canceled":
status = 'Canceled'
elif CallType == "incomplete" and DialCallStatus == "failed":
elif call_type == "incomplete" and dial_call_status == "failed":
status = 'Failed'
update_call_log(kwargs, status)

View File

@ -141,11 +141,10 @@ class CallPopup {
'fieldtype': 'Section Break',
'hide_border': 1,
}, {
'fieldname': 'type_of_call',
'label': 'Type Of Call',
'fieldtype': 'Select',
'options': '\nFrappe Cloud Queries/Plan\nEnterprise Plans\nPartnership\nSupport\nBilling/Renewal\nOpen source / Junk',
'default': 'Frappe Cloud Queries/Plan',
'fieldname': 'call_type',
'label': 'Call Type',
'fieldtype': 'Link',
'options': 'Telephony Call Type',
},{
'fieldtype': 'Section Break',
'hide_border': 1,
@ -158,7 +157,7 @@ class CallPopup {
'label': __('Save'),
'click': () => {
const call_summary = this.call_details.get_value('call_summary');
const call_type = this.call_details.get_value('type_of_call');
const call_type = this.call_details.get_value('call_type');
if (!call_summary) return;
frappe.xcall('erpnext.telephony.doctype.call_log.call_log.add_call_summary_and_call_type', {
'call_log': this.call_log.name,

View File

@ -9,7 +9,7 @@
"id",
"from",
"to",
"employee_call_directed_to",
"call_received_by",
"employee_user_id",
"medium",
"start_time",
@ -139,13 +139,6 @@
"fieldtype": "Section Break",
"label": "Call Details"
},
{
"depends_on": "to",
"fieldname": "employee_call_directed_to",
"fieldtype": "Data",
"label": "Employee Call Directed To",
"read_only": 1
},
{
"fieldname": "employee_user_id",
"fieldtype": "Data",
@ -156,12 +149,19 @@
"fieldname": "type_of_call",
"fieldtype": "Data",
"label": "Type Of Call"
},
{
"depends_on": "to",
"fieldname": "call_received_by",
"fieldtype": "Data",
"label": "Call Received By",
"read_only": 1
}
],
"in_create": 1,
"index_web_pages_for_search": 1,
"links": [],
"modified": "2022-02-25 13:37:48.156501",
"modified": "2022-02-25 14:37:48.575230",
"modified_by": "Administrator",
"module": "Telephony",
"name": "Call Log",

View File

@ -38,9 +38,11 @@ class CallLog(Document):
# Taking the last 10 digits of the number
emp_number_reversed = (self.get("to"))[-1:-11:-1]
emp_number = emp_number_reversed[-1::-1]
employee = frappe.get_all("Employee", filters={
"cell_number": ["like", "%"+emp_number+"%"]
}, fields=["first_name", "middle_name", "last_name", "user_id"])
employee = frappe.get_all("Employee", filters={"cell_number":["like","%"+emp_number+"%"]}, fields=["first_name", "middle_name", "last_name", "user_id"])
self.employee_call_directed_to = get_employee_name(employee[0])
self.call_received_by = get_employee_name(employee[0])
self.employee_user_id = employee[0].get("user_id") or ''
def after_insert(self):

View File

@ -0,0 +1,8 @@
// Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.ui.form.on('Telephony Call Type', {
// refresh: function(frm) {
// }
});

View File

@ -0,0 +1,58 @@
{
"actions": [],
"allow_rename": 1,
"autoname": "field:call_type",
"creation": "2022-02-25 16:13:37.321312",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"call_type",
"amended_from"
],
"fields": [
{
"fieldname": "call_type",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Call Type",
"reqd": 1,
"unique": 1
},
{
"fieldname": "amended_from",
"fieldtype": "Link",
"label": "Amended From",
"no_copy": 1,
"options": "Telephony Call Type",
"print_hide": 1,
"read_only": 1
}
],
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2022-02-25 16:14:07.087461",
"modified_by": "Administrator",
"module": "Telephony",
"name": "Telephony Call Type",
"naming_rule": "By fieldname",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"sort_field": "modified",
"sort_order": "DESC",
"states": []
}

View File

@ -0,0 +1,8 @@
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class TelephonyCallType(Document):
pass

View File

@ -0,0 +1,8 @@
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
# import frappe
import unittest
class TestTelephonyCallType(unittest.TestCase):
pass