From 3dcb29dc7b98cc96400991d7151d161a093848ce Mon Sep 17 00:00:00 2001 From: Gaurav Naik Date: Sun, 30 Apr 2017 16:32:23 +0530 Subject: [PATCH 1/2] [Mod] Popup and Lead Name --- awfis_erpnext/awfis_erpnext/awf.py | 11 ++++++++--- awfis_erpnext/templates/lead_info.html | 11 +++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/awfis_erpnext/awfis_erpnext/awf.py b/awfis_erpnext/awfis_erpnext/awf.py index fbfffa2..c3ac7e3 100644 --- a/awfis_erpnext/awfis_erpnext/awf.py +++ b/awfis_erpnext/awfis_erpnext/awf.py @@ -115,14 +115,15 @@ def create_popup(caller_number, agent_id, call_id): ld_name = frappe.db.get_value("Lead", {"mobile_no": caller_number_processed}, "name") # frappe.get_all("Lead", fields=["*"], filters={"mobile_no": caller_number_processed}) + is_new_lead = False if not ld_name: #Create stub lead if lead is not found. ld = frappe.new_doc("Lead") ld.mobile_no = caller_number_processed - ld.lead_name = "New Lead ({m})".format(m=caller_number) + ld.lead_name = "Lead ({m})".format(m=caller_number) #Set mandatory custom fields. - ld.first_name = "New Lead ({m})".format(m=caller_number) + ld.first_name = "Lead ({m})".format(m=caller_number) ld.awfis_mobile_no = caller_number_processed ld.source = "Other" ld.awfis_lead_territory = "All Territories" @@ -131,9 +132,12 @@ def create_popup(caller_number, agent_id, call_id): frappe.set_user(agent_id) ld.insert(ignore_permissions=True) frappe.db.commit() + + is_new_lead = 1 else: ld = frappe.get_doc("Lead", ld_name) + is_new_lead = 0 #Make popup content. lead_fields = {"mobile_no": caller_number, @@ -141,7 +145,8 @@ def create_popup(caller_number, agent_id, call_id): "company_name": ld.company_name, "name": ld.name, "call_timestamp": frappe.utils.datetime.datetime.strftime(frappe.utils.datetime.datetime.today(), '%d/%m/%Y %H:%M:%S'), - "call_id": call_id} + "call_id": call_id, + "is_new_lead": is_new_lead} popup_content = frappe.render_template("awfis_erpnext/templates/lead_info.html", lead_fields) diff --git a/awfis_erpnext/templates/lead_info.html b/awfis_erpnext/templates/lead_info.html index 59c4085..b8eee9d 100644 --- a/awfis_erpnext/templates/lead_info.html +++ b/awfis_erpnext/templates/lead_info.html @@ -1,7 +1,14 @@

Incoming Call


Call ID: {{ call_id }} received at {{ call_timestamp }} \ No newline at end of file From 23609e55086f655fb6f66f7b15d1878c90913736 Mon Sep 17 00:00:00 2001 From: Gaurav Naik Date: Sun, 30 Apr 2017 17:38:44 +0600 Subject: [PATCH 2/2] bumped to version 2.0.1 --- awfis_erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awfis_erpnext/__init__.py b/awfis_erpnext/__init__.py index 32495c8..5aef465 100644 --- a/awfis_erpnext/__init__.py +++ b/awfis_erpnext/__init__.py @@ -1,3 +1,3 @@ from __future__ import unicode_literals -__version__ = '2.0.0' +__version__ = '2.0.1'