diff --git a/erpnext/crm/doctype/opportunity/opportunity.js b/erpnext/crm/doctype/opportunity/opportunity.js index e70745e8f51..1afea839507 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.js +++ b/erpnext/crm/doctype/opportunity/opportunity.js @@ -37,9 +37,8 @@ frappe.ui.form.on("Opportunity", { refresh: function(frm) { var doc = frm.doc; - // frm.events.enquiry_from(frm); + frm.events.opportunity_from(frm); frm.trigger('toggle_mandatory'); - frm.trigger("set_dynamic_field_label"); erpnext.toggle_naming_series(); if(!doc.__islocal && doc.status!=="Lost") { diff --git a/erpnext/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py index 72851d98fcc..8d7479fd896 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.py +++ b/erpnext/crm/doctype/opportunity/opportunity.py @@ -44,7 +44,7 @@ class Opportunity(TransactionBase): def make_new_lead_if_required(self): """Set lead against new opportunity""" - if not self.customer_lead and self.contact_email: #nosec + if (not self.get("customer_lead")) and self.contact_email: # check if customer is already created agains the self.contact_email customer = frappe.db.sql("""select distinct `tabDynamic Link`.link_name as customer @@ -242,7 +242,7 @@ def make_quotation(source_name, target_doc=None): "Opportunity": { "doctype": "Quotation", "field_map": { - "enquiry_from": "quotation_to", + "opportunity_from": "quotation_to", "opportunity_type": "order_type", "name": "enq_no", } diff --git a/erpnext/crm/doctype/opportunity/opportunity_list.js b/erpnext/crm/doctype/opportunity/opportunity_list.js index 0dbbf8add1c..9712fb04c56 100644 --- a/erpnext/crm/doctype/opportunity/opportunity_list.js +++ b/erpnext/crm/doctype/opportunity/opportunity_list.js @@ -1,5 +1,5 @@ frappe.listview_settings['Opportunity'] = { - add_fields: ["customer_name", "opportunity_type", "enquiry_from", "status"], + add_fields: ["customer_name", "opportunity_type", "opportunity_from", "status"], get_indicator: function(doc) { var indicator = [__(doc.status), frappe.utils.guess_colour(doc.status), "status,=," + doc.status]; if(doc.status=="Quotation") { diff --git a/erpnext/crm/doctype/opportunity/test_opportunity.js b/erpnext/crm/doctype/opportunity/test_opportunity.js index f2b04f86474..45b97ddc4d1 100644 --- a/erpnext/crm/doctype/opportunity/test_opportunity.js +++ b/erpnext/crm/doctype/opportunity/test_opportunity.js @@ -6,7 +6,7 @@ QUnit.test("test: opportunity", function (assert) { () => frappe.timeout(1), () => frappe.click_button('New'), () => frappe.timeout(1), - () => cur_frm.set_value('enquiry_from', 'Customer'), + () => cur_frm.set_value('opportunity_from', 'Customer'), () => cur_frm.set_value('customer', 'Test Customer 1'), // check items diff --git a/erpnext/crm/report/lead_conversion_time/lead_conversion_time.py b/erpnext/crm/report/lead_conversion_time/lead_conversion_time.py index d9ee30ec1ae..d91b9c5607d 100644 --- a/erpnext/crm/report/lead_conversion_time/lead_conversion_time.py +++ b/erpnext/crm/report/lead_conversion_time/lead_conversion_time.py @@ -66,7 +66,7 @@ def get_columns(): def get_communication_details(filters): communication_count = None communication_list = [] - opportunities = frappe.db.get_values('Opportunity', {'enquiry_from': 'Lead'},\ + opportunities = frappe.db.get_values('Opportunity', {'opportunity_from': 'Lead'},\ ['name', 'customer_name', 'lead', 'contact_email'], as_dict=1) for d in opportunities: diff --git a/erpnext/demo/user/sales.py b/erpnext/demo/user/sales.py index 69ba9007a61..3809c1f0924 100644 --- a/erpnext/demo/user/sales.py +++ b/erpnext/demo/user/sales.py @@ -56,7 +56,7 @@ def work(domain="Manufacturing"): def make_opportunity(domain): b = frappe.get_doc({ "doctype": "Opportunity", - "enquiry_from": "Customer", + "opportunity_from": "Customer", "customer": get_random("Customer"), "opportunity_type": "Sales", "with_items": 1, diff --git a/erpnext/hub_node/legacy.py b/erpnext/hub_node/legacy.py index 9daee2752fa..95ada76a6a5 100644 --- a/erpnext/hub_node/legacy.py +++ b/erpnext/hub_node/legacy.py @@ -28,7 +28,7 @@ def make_opportunity(buyer_name, email_id): lead.save(ignore_permissions=True) o = frappe.new_doc("Opportunity") - o.enquiry_from = "Lead" + o.opportunity_from = "Lead" o.lead = frappe.get_all("Lead", filters={"email_id": email_id}, fields = ["name"])[0]["name"] o.save(ignore_permissions=True) diff --git a/erpnext/setup/setup_wizard/operations/sample_data.py b/erpnext/setup/setup_wizard/operations/sample_data.py index 3f787347393..e21c9bd1089 100644 --- a/erpnext/setup/setup_wizard/operations/sample_data.py +++ b/erpnext/setup/setup_wizard/operations/sample_data.py @@ -33,7 +33,7 @@ def make_sample_data(domains, make_dependent = False): def make_opportunity(items, customer): b = frappe.get_doc({ "doctype": "Opportunity", - "enquiry_from": "Customer", + "opportunity_from": "Customer", "customer": customer, "opportunity_type": _("Sales"), "with_items": 1 diff --git a/erpnext/templates/utils.py b/erpnext/templates/utils.py index cb44fd30d22..97e2a7f7235 100644 --- a/erpnext/templates/utils.py +++ b/erpnext/templates/utils.py @@ -28,7 +28,7 @@ def send_message(subject="Website Query", message="", sender="", status="Open"): opportunity = frappe.get_doc(dict( doctype ='Opportunity', - enquiry_from = 'Customer' if customer else 'Lead', + opportunity_from = 'Customer' if customer else 'Lead', status = 'Open', title = subject, contact_email = sender,