fix: added field to show called group, user_id
diff --git a/erpnext/telephony/doctype/call_log/call_log.json b/erpnext/telephony/doctype/call_log/call_log.json
index a3dbb02..c0f022b 100644
--- a/erpnext/telephony/doctype/call_log/call_log.json
+++ b/erpnext/telephony/doctype/call_log/call_log.json
@@ -10,6 +10,7 @@
"from",
"to",
"employee_call_directed_to",
+ "employee_user_id",
"medium",
"start_time",
"end_time",
@@ -142,12 +143,18 @@
"fieldtype": "Data",
"label": "Employee Call Directed To",
"read_only": 1
+ },
+ {
+ "fieldname": "employee_user_id",
+ "fieldtype": "Data",
+ "hidden": 1,
+ "label": "Employee User Id"
}
],
"in_create": 1,
"index_web_pages_for_search": 1,
"links": [],
- "modified": "2022-02-23 18:45:06.932571",
+ "modified": "2022-02-23 19:47:04.310577",
"modified_by": "Administrator",
"module": "Telephony",
"name": "Call Log",
diff --git a/erpnext/telephony/doctype/call_log/call_log.py b/erpnext/telephony/doctype/call_log/call_log.py
index 7d86d12..7870151 100644
--- a/erpnext/telephony/doctype/call_log/call_log.py
+++ b/erpnext/telephony/doctype/call_log/call_log.py
@@ -39,8 +39,9 @@
emp_number_reversed = (self.get("to"))[-1:-11:-1]
emp_number = emp_number_reversed[-1::-1]
- emp_name = frappe.get_all("Employee", filters={"cell_number":["like","%"+emp_number+"%"]}, fields=["first_name", "middle_name", "last_name"])
- self.employee_call_directed_to = (emp_name[0].get("first_name") or '') + ' ' + (emp_name[0].get("middle_name") or '') + ' ' + (emp_name[0].get("last_name") or '')
+ 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.employee_user_id = employee[0].get("user_id") or ''
def after_insert(self):
self.trigger_call_popup()
@@ -93,6 +94,13 @@
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(call_log, summary):