fix: Create call log instead of communication
diff --git a/erpnext/crm/doctype/utils.py b/erpnext/crm/doctype/utils.py
index 26cb298..93d440c 100644
--- a/erpnext/crm/doctype/utils.py
+++ b/erpnext/crm/doctype/utils.py
@@ -70,12 +70,13 @@
@frappe.whitelist()
def add_call_summary(docname, summary):
- communication = frappe.get_doc('Communication', docname)
+ call_log = frappe.get_doc('Call Log', docname)
content = _('Call Summary by {0}: {1}').format(
frappe.utils.get_fullname(frappe.session.user), summary)
- if not communication.content:
- communication.content = content
+ if not call_log.call_summary:
+ call_log.call_summary = content
else:
- communication.content += '\n' + content
- communication.save(ignore_permissions=True)
+ call_log.call_summary += '<br>' + content
+ call_log.save(ignore_permissions=True)
+
diff --git a/erpnext/erpnext_integrations/exotel_integration.py b/erpnext/erpnext_integrations/exotel_integration.py
index c70b094..358eb3b 100644
--- a/erpnext/erpnext_integrations/exotel_integration.py
+++ b/erpnext/erpnext_integrations/exotel_integration.py
@@ -47,29 +47,20 @@
def get_call_log(call_payload, create_new_if_not_found=True):
- communication = frappe.get_all('Communication', {
- 'communication_medium': 'Phone',
+ call_log = frappe.get_all('Call Log', {
'call_id': call_payload.get('CallSid'),
}, limit=1)
- if communication:
- communication = frappe.get_doc('Communication', communication[0].name)
- return communication
+ if call_log:
+ return frappe.get_doc('Call Log', call_log[0].name)
elif create_new_if_not_found:
- communication = frappe.new_doc('Communication')
- communication.subject = frappe._('Call from {}').format(call_payload.get("CallFrom"))
- communication.communication_medium = 'Phone'
- communication.phone_no = call_payload.get("CallFrom")
- communication.comment_type = 'Info'
- communication.communication_type = 'Communication'
- communication.sent_or_received = 'Received'
- communication.communication_date = call_payload.get('StartTime')
- communication.call_id = call_payload.get('CallSid')
- communication.status = 'Open'
- communication.content = frappe._('Call from {}').format(call_payload.get("CallFrom"))
- communication.save(ignore_permissions=True)
+ call_log = frappe.new_doc('Call Log')
+ call_log.call_id = call_payload.get('CallSid')
+ call_log.call_from = call_payload.get('CallFrom')
+ call_log.status = 'Ringing'
+ call_log.save(ignore_permissions=True)
frappe.db.commit()
- return communication
+ return call_log
@frappe.whitelist()
def get_call_status(call_id):