Skip to content

Commit 28fe736

Browse files
fix: Dynamic link fixes in quotation and opportunity
1 parent 7cfe247 commit 28fe736

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

erpnext/crm/doctype/opportunity/opportunity.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ frappe.ui.form.on("Opportunity", {
2020
});
2121
},
2222

23+
customer_lead: function(frm) {
24+
if (frm.doc.opportunity_from == "Customer") {
25+
frm.trigger('set_contact_link');
26+
erpnext.utils.get_party_details(frm);
27+
}
28+
},
29+
2330
with_items: function(frm) {
2431
frm.trigger('toggle_mandatory');
2532
},
@@ -73,6 +80,14 @@ frappe.ui.form.on("Opportunity", {
7380
}
7481
},
7582

83+
set_contact_link: function(frm) {
84+
if(frm.doc.opportunity_from == "Customer" && frm.doc.customer_lead) {
85+
frappe.dynamic_link = {doc: frm.doc, fieldname: 'customer', doctype: 'Customer'}
86+
} else if(frm.doc.opportunity_from == "Lead" && frm.doc.customer_lead) {
87+
frappe.dynamic_link = {doc: frm.doc, fieldname: 'lead', doctype: 'Lead'}
88+
}
89+
},
90+
7691
set_dynamic_field_label: function(frm){
7792
if (frm.doc.opportunity_from == "Customer")
7893
{

erpnext/selling/doctype/quotation/quotation.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
4444
},
4545
refresh: function(doc, dt, dn) {
4646
this._super(doc, dt, dn);
47+
doctype = doc.quotation_to == 'Customer' ? 'Customer':'Lead';
48+
frappe.dynamic_link = {doc: this.frm.doc, fieldname: doctype.toLowerCase(), doctype: doctype}
4749

4850
var me = this;
4951

0 commit comments

Comments
 (0)