mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 16:04:46 +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() {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -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