fix: Dynamic link fixes in quotation and opportunity

This commit is contained in:
deepeshgarg007
2019-04-16 15:21:51 +05:30
parent 7cfe247b2e
commit 28fe73640b
2 changed files with 17 additions and 0 deletions

View File

@@ -20,6 +20,13 @@ frappe.ui.form.on("Opportunity", {
});
},
customer_lead: function(frm) {
if (frm.doc.opportunity_from == "Customer") {
frm.trigger('set_contact_link');
erpnext.utils.get_party_details(frm);
}
},
with_items: function(frm) {
frm.trigger('toggle_mandatory');
},
@@ -73,6 +80,14 @@ frappe.ui.form.on("Opportunity", {
}
},
set_contact_link: function(frm) {
if(frm.doc.opportunity_from == "Customer" && frm.doc.customer_lead) {
frappe.dynamic_link = {doc: frm.doc, fieldname: 'customer', doctype: 'Customer'}
} else if(frm.doc.opportunity_from == "Lead" && frm.doc.customer_lead) {
frappe.dynamic_link = {doc: frm.doc, fieldname: 'lead', doctype: 'Lead'}
}
},
set_dynamic_field_label: function(frm){
if (frm.doc.opportunity_from == "Customer")
{

View File

@@ -44,6 +44,8 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
},
refresh: function(doc, dt, dn) {
this._super(doc, dt, dn);
doctype = doc.quotation_to == 'Customer' ? 'Customer':'Lead';
frappe.dynamic_link = {doc: this.frm.doc, fieldname: doctype.toLowerCase(), doctype: doctype}
var me = this;