diff --git a/.pylintrc b/.pylintrc deleted file mode 100644 index 4b2ea0a5647..00000000000 --- a/.pylintrc +++ /dev/null @@ -1 +0,0 @@ -disable=access-member-before-definition \ No newline at end of file diff --git a/erpnext/crm/doctype/lead/lead.js b/erpnext/crm/doctype/lead/lead.js index 8c1ab2f38f5..d2e907d162b 100644 --- a/erpnext/crm/doctype/lead/lead.js +++ b/erpnext/crm/doctype/lead/lead.js @@ -33,6 +33,7 @@ erpnext.LeadController = frappe.ui.form.Controller.extend({ frappe.dynamic_link = { doc: doc, fieldname: 'name', doctype: 'Lead' } if(!doc.__islocal && doc.__onload && !doc.__onload.is_customer) { + this.frm.add_custom_button(__("Call"), this.call); this.frm.add_custom_button(__("Customer"), this.create_customer, __('Create')); this.frm.add_custom_button(__("Opportunity"), this.create_opportunity, __('Create')); this.frm.add_custom_button(__("Quotation"), this.make_quotation, __('Create')); @@ -52,6 +53,14 @@ erpnext.LeadController = frappe.ui.form.Controller.extend({ }) }, + call: () => { + frappe.xcall('erpnext.erpnext_integrations.exotel_integration.make_a_call', { + 'to_number': this.frm.doc.phone, + 'from_number': '', + 'caller_id': '09513886363' + }).then(console.log) + }, + create_opportunity: function () { frappe.model.open_mapped_doc({ method: "erpnext.crm.doctype.lead.lead.make_opportunity", diff --git a/erpnext/public/js/call_popup/call_popup.js b/erpnext/public/js/call_popup/call_popup.js index a15c37c85d6..4fd3a5539fb 100644 --- a/erpnext/public/js/call_popup/call_popup.js +++ b/erpnext/public/js/call_popup/call_popup.js @@ -35,15 +35,19 @@ class CallPopup { 'fieldname': 'call_summary', }, { 'fieldtype': 'Button', - 'label': 'Submit', + 'label': 'Save', 'click': () => { - const values = this.dialog.get_values(); - if (!values.call_summary) return; + const call_summary = this.dialog.get_value('call_summary'); + if (!call_summary) return; frappe.xcall('erpnext.crm.doctype.utils.add_call_summary', { 'docname': this.call_log.id, - 'summary': values.call_summary, + 'summary': call_summary, }).then(() => { - this.dialog.set_value('call_summary', ''); + this.close_modal(); + frappe.show_alert({ + message: `${__('Call Summary Saved')}
${__('View call log')}`, + indicator: 'green' + }); }); } }], @@ -52,10 +56,7 @@ class CallPopup { this.make_caller_info_section(); this.dialog.get_close_btn().show(); this.dialog.$body.addClass('call-popup'); - this.dialog.set_secondary_action(() => { - delete erpnext.call_popup; - this.dialog.hide(); - }); + this.dialog.set_secondary_action(this.close_modal); frappe.utils.play_sound("incoming-call"); this.dialog.show(); } @@ -71,7 +72,7 @@ class CallPopup { if (!contact) { wrapper.append(`
-
Unknown Number: ${this.caller_number}
+
${__('Unknown Number')}: ${this.caller_number}
${__('Create New Contact')} @@ -131,10 +132,19 @@ class CallPopup { this.set_call_status(); } + close_modal() { + delete erpnext.call_popup; + this.dialog.hide(); + } + call_disconnected(call_log) { frappe.utils.play_sound("call-disconnect"); this.update_call_log(call_log); - setTimeout(this.get_close_btn().click, 10000); + setTimeout(() => { + if (!this.dialog.get_value('call_summary')) { + this.close_modal(); + } + }, 10000); } make_last_interaction_section() { @@ -145,14 +155,12 @@ class CallPopup { const comm_field = this.dialog.fields_dict["last_communication"]; if (data.last_communication) { const comm = data.last_communication; - // this.dialog.set_df_property('last_interaction', 'hidden', false); comm_field.set_value(comm.content); comm_field.$wrapper.append(frappe.utils.get_form_link('Communication', comm.name)); } if (data.last_issue) { const issue = data.last_issue; - // this.dialog.set_df_property('last_interaction', 'hidden', false); const issue_field = this.dialog.fields_dict["last_issue"]; issue_field.set_value(issue.subject); issue_field.$wrapper.append(`