fix: Add call summary

This commit is contained in:
Suraj Shetty 2019-05-31 13:42:22 +05:30
parent bd03a51e8f
commit 893a0c24bb
2 changed files with 14 additions and 18 deletions

View File

@ -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
}
}
@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)

View File

@ -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', '');
});