fix: Change enquiry_from to opportunity_from in multiple files
This commit is contained in:
@@ -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") {
|
||||
|
||||
@@ -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",
|
||||
}
|
||||
|
||||
@@ -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") {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user