From f5b967a9478b2baf2a107921fa1f2679a79bc2c5 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Mon, 4 Apr 2022 07:28:41 +0530 Subject: [PATCH] chore: Remove unused code - and simplify get_call_log --- erpnext/erpnext_integrations/exotel_integration.py | 13 +++---------- erpnext/telephony/doctype/call_log/call_log.py | 7 ------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/erpnext/erpnext_integrations/exotel_integration.py b/erpnext/erpnext_integrations/exotel_integration.py index 84c69a6b97d..a8a1aa88a2e 100644 --- a/erpnext/erpnext_integrations/exotel_integration.py +++ b/erpnext/erpnext_integrations/exotel_integration.py @@ -68,16 +68,9 @@ def update_call_log(call_payload, status="Ringing", call_log=None): def get_call_log(call_payload): - call_log = frappe.get_all( - "Call Log", - { - "id": call_payload.get("CallSid"), - }, - limit=1, - ) - - if call_log: - return frappe.get_doc("Call Log", call_log[0].name) + call_log_id = call_payload.get("CallSid") + if frappe.db.exists("Call Log", call_log_id): + return frappe.get_doc("Call Log", call_log_id) def create_call_log(call_payload): diff --git a/erpnext/telephony/doctype/call_log/call_log.py b/erpnext/telephony/doctype/call_log/call_log.py index 18d354a1895..0daecc05432 100644 --- a/erpnext/telephony/doctype/call_log/call_log.py +++ b/erpnext/telephony/doctype/call_log/call_log.py @@ -94,13 +94,6 @@ class CallLog(Document): for email in emails: frappe.publish_realtime("show_call_popup", self, user=email) -def get_employee_name(emp): - employee_name = '' - for name in ['first_name', 'middle_name', 'last_name']: - if emp.get(name): - employee_name += (' ' if employee_name else '') + emp.get(name) - return employee_name - @frappe.whitelist() def add_call_summary_and_call_type(call_log, summary, call_type):