mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-30 01:22:18 +02: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) {
|
||||
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) {
|
||||
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"],
|
||||
["customer", "customer"],
|
||||
["contact_person", "contact_query"]],
|
||||
function(i, opts) {
|
||||
me.frm.set_query(opts[0], erpnext.queries[opts[1]]);
|
||||
});
|
||||
me.frm.set_query('contact_person', erpnext.queries['contact_query'])
|
||||
|
||||
if (me.frm.doc.opportunity_from == "Lead") {
|
||||
me.frm.set_query('party_name', erpnext.queries['lead']);
|
||||
}
|
||||
else if (me.frm.doc.opportunity_from == "Cuatomer") {
|
||||
me.frm.set_query('party_name', erpnext.queries['customer']);
|
||||
}
|
||||
},
|
||||
|
||||
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() {
|
||||
me.apply_price_list();
|
||||
});
|
||||
|
||||
if(me.frm.doc.quotation_to=="Lead") {
|
||||
me.frm.trigger("get_lead_details");
|
||||
}
|
||||
},
|
||||
refresh: function(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'),
|
||||
function() {
|
||||
var setters = {};
|
||||
if(me.frm.doc.customer) {
|
||||
setters.customer = me.frm.doc.customer || undefined;
|
||||
} else if (me.frm.doc.lead) {
|
||||
setters.lead = me.frm.doc.lead || undefined;
|
||||
if(me.frm.doc.quotation_to == "Customer" && me.frm.doc.party_name) {
|
||||
setters.customer = me.frm.doc.party_name || undefined;
|
||||
} else if (me.frm.doc.quotation_to == "Lead" && me.frm.doc.party_name) {
|
||||
setters.lead = me.frm.doc.party_name || undefined;
|
||||
}
|
||||
erpnext.utils.map_current_doc({
|
||||
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;
|
||||
if(!this.frm.doc.lead) {
|
||||
if(!this.frm.doc.quotation_to === "Lead") {
|
||||
return;
|
||||
}
|
||||
|
||||
frappe.call({
|
||||
method: "erpnext.crm.doctype.lead.lead.get_lead_details",
|
||||
args: {
|
||||
'lead': this.frm.doc.lead,
|
||||
'lead': this.frm.doc.party_name,
|
||||
'posting_date': this.frm.doc.transaction_date,
|
||||
'company': this.frm.doc.company,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user