fix: Handle exception where no employee is returned
This commit is contained in:
parent
39abfae5fe
commit
cfee53eb55
@ -35,10 +35,10 @@ class CallLog(Document):
|
|||||||
# Add Employee Name
|
# Add Employee Name
|
||||||
if self.is_incoming_call():
|
if self.is_incoming_call():
|
||||||
# Taking the last 10 digits of the number
|
# Taking the last 10 digits of the number
|
||||||
employee = get_employees_with_number(self.get("to"))
|
employees = get_employees_with_number(self.get("to"))
|
||||||
|
if employees:
|
||||||
self.call_received_by = employee[0].get("name")
|
self.call_received_by = employees[0].get("name")
|
||||||
self.employee_user_id = employee[0].get("user_id")
|
self.employee_user_id = employees[0].get("user_id")
|
||||||
|
|
||||||
def after_insert(self):
|
def after_insert(self):
|
||||||
self.trigger_call_popup()
|
self.trigger_call_popup()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user