mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 00:14:50 +00:00
fix: Query fixes in quotation and opportunity (#17619)
* fix: Query fixes for contact person and minor fixes * fix: Change quotation to quotation_to
This commit is contained in:
@@ -82,9 +82,9 @@ frappe.ui.form.on("Opportunity", {
|
|||||||
|
|
||||||
set_contact_link: function(frm) {
|
set_contact_link: function(frm) {
|
||||||
if(frm.doc.opportunity_from == "Customer" && frm.doc.party_name) {
|
if(frm.doc.opportunity_from == "Customer" && frm.doc.party_name) {
|
||||||
frappe.dynamic_link = {doc: frm.doc, fieldname: 'customer', doctype: 'Customer'}
|
frappe.dynamic_link = {doc: frm.doc, fieldname: 'party_name', doctype: 'Customer'}
|
||||||
} else if(frm.doc.opportunity_from == "Lead" && frm.doc.party_name) {
|
} else if(frm.doc.opportunity_from == "Lead" && frm.doc.party_name) {
|
||||||
frappe.dynamic_link = {doc: frm.doc, fieldname: 'lead', doctype: 'Lead'}
|
frappe.dynamic_link = {doc: frm.doc, fieldname: 'party_name', doctype: 'Lead'}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -138,12 +138,14 @@ erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
$.each([["lead", "lead"],
|
me.frm.set_query('contact_person', erpnext.queries['contact_query'])
|
||||||
["customer", "customer"],
|
|
||||||
["contact_person", "contact_query"]],
|
if (me.frm.doc.opportunity_from == "Lead") {
|
||||||
function(i, opts) {
|
me.frm.set_query('party_name', erpnext.queries['lead']);
|
||||||
me.frm.set_query(opts[0], erpnext.queries[opts[1]]);
|
}
|
||||||
});
|
else if (me.frm.doc.opportunity_from == "Cuatomer") {
|
||||||
|
me.frm.set_query('party_name', erpnext.queries['customer']);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
create_quotation: function() {
|
create_quotation: function() {
|
||||||
|
|||||||
@@ -878,7 +878,7 @@
|
|||||||
"collapsible": 1,
|
"collapsible": 1,
|
||||||
"collapsible_depends_on": "next_contact_by",
|
"collapsible_depends_on": "next_contact_by",
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
"depends_on": "eval:doc.lead || doc.customer",
|
"depends_on": "eval:doc.party_name",
|
||||||
"fetch_if_empty": 0,
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "contact_info",
|
"fieldname": "contact_info",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
@@ -912,7 +912,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
"depends_on": "eval:doc.customer || doc.lead",
|
"depends_on": "eval:doc.party_name",
|
||||||
"fetch_if_empty": 0,
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "customer_address",
|
"fieldname": "customer_address",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
@@ -1083,7 +1083,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
"depends_on": "eval:doc.lead || doc.customer",
|
"depends_on": "eval:doc.party_name",
|
||||||
"fetch_if_empty": 0,
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "contact_person",
|
"fieldname": "contact_person",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
@@ -1150,7 +1150,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
"depends_on": "eval:doc.lead || doc.customer",
|
"depends_on": "eval:doc.party_name",
|
||||||
"fetch_if_empty": 0,
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "contact_email",
|
"fieldname": "contact_email",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
@@ -1183,7 +1183,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
"depends_on": "eval:doc.lead || doc.customer",
|
"depends_on": "eval:doc.party_name",
|
||||||
"fetch_if_empty": 0,
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "contact_mobile",
|
"fieldname": "contact_mobile",
|
||||||
"fieldtype": "Small Text",
|
"fieldtype": "Small Text",
|
||||||
|
|||||||
@@ -47,6 +47,10 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
|
|||||||
erpnext.utils.get_party_details(this.frm, null, null, function() {
|
erpnext.utils.get_party_details(this.frm, null, null, function() {
|
||||||
me.apply_price_list();
|
me.apply_price_list();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(me.frm.doc.quotation_to=="Lead") {
|
||||||
|
me.frm.trigger("get_lead_details");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
refresh: function(doc, dt, dn) {
|
refresh: function(doc, dt, dn) {
|
||||||
this._super(doc, dt, dn);
|
this._super(doc, dt, dn);
|
||||||
@@ -87,10 +91,10 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
|
|||||||
this.frm.add_custom_button(__('Opportunity'),
|
this.frm.add_custom_button(__('Opportunity'),
|
||||||
function() {
|
function() {
|
||||||
var setters = {};
|
var setters = {};
|
||||||
if(me.frm.doc.customer) {
|
if(me.frm.doc.quotation_to == "Customer" && me.frm.doc.party_name) {
|
||||||
setters.customer = me.frm.doc.customer || undefined;
|
setters.customer = me.frm.doc.party_name || undefined;
|
||||||
} else if (me.frm.doc.lead) {
|
} else if (me.frm.doc.quotation_to == "Lead" && me.frm.doc.party_name) {
|
||||||
setters.lead = me.frm.doc.lead || undefined;
|
setters.lead = me.frm.doc.party_name || undefined;
|
||||||
}
|
}
|
||||||
erpnext.utils.map_current_doc({
|
erpnext.utils.map_current_doc({
|
||||||
method: "erpnext.crm.doctype.opportunity.opportunity.make_quotation",
|
method: "erpnext.crm.doctype.opportunity.opportunity.make_quotation",
|
||||||
@@ -162,16 +166,16 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
lead: function() {
|
get_lead_details: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
if(!this.frm.doc.lead) {
|
if(!this.frm.doc.quotation_to === "Lead") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "erpnext.crm.doctype.lead.lead.get_lead_details",
|
method: "erpnext.crm.doctype.lead.lead.get_lead_details",
|
||||||
args: {
|
args: {
|
||||||
'lead': this.frm.doc.lead,
|
'lead': this.frm.doc.party_name,
|
||||||
'posting_date': this.frm.doc.transaction_date,
|
'posting_date': this.frm.doc.transaction_date,
|
||||||
'company': this.frm.doc.company,
|
'company': this.frm.doc.company,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user