diff --git a/erpnext/crm/doctype/utils.py b/erpnext/crm/doctype/utils.py index 36cb0c1f23..9399fba40f 100644 --- a/erpnext/crm/doctype/utils.py +++ b/erpnext/crm/doctype/utils.py @@ -65,4 +65,14 @@ def get_last_interaction(number, reference_doc): return { 'last_communication': last_communication[0] if last_communication else None, 'last_issue': last_issue[0] if last_issue else None - } \ No newline at end of file + } + +@frappe.whitelist() +def add_call_summary(docname, summary): + communication = frappe.get_doc('Communication', docname) + communication.content = 'Call Summary by {user}: {summary}'.format({ + 'user': frappe.utils.get_fullname(frappe.session.user), + 'summary': summary + }) + communication.save(ignore_permissions=True) + diff --git a/erpnext/public/js/call_popup/call_popup.js b/erpnext/public/js/call_popup/call_popup.js index 3fa5fa63c6..2410684429 100644 --- a/erpnext/public/js/call_popup/call_popup.js +++ b/erpnext/public/js/call_popup/call_popup.js @@ -38,28 +38,14 @@ class CallPopup { 'fieldtype': 'Small Text', 'label': 'Call Summary', 'fieldname': 'call_summary', - }, { - 'label': 'Append To', - 'fieldtype': 'Select', - 'fieldname': 'doctype', - 'options': ['Issue', 'Lead', 'Communication'], - 'default': this.call_log.doctype - }, { - 'label': 'Document', - 'fieldtype': 'Dynamic Link', - 'fieldname': 'docname', - 'options': 'doctype', - 'default': this.call_log.name }, { 'fieldtype': 'Button', 'label': 'Submit', 'click': () => { const values = this.dialog.get_values(); - frappe.xcall('frappe.desk.form.utils.add_comment', { - 'reference_doctype': values.doctype, - 'reference_name': values.docname, - 'content': `${__('Call Summary')}: ${values.call_summary}`, - 'comment_email': frappe.session.user + frappe.xcall('erpnext.crm.doctype.utils.add_call_summary', { + 'docname': this.call_log.name, + 'summary': `${__('Call Summary')}: ${values.call_summary}`, }).then(() => { this.dialog.set_value('call_summary', ''); });