Skip to content

Commit

Permalink
fix: Set contact filter link in Opportunity (#34325)
Browse files Browse the repository at this point in the history
fix: Set contact filter link in Opportunity (#34325)

Co-authored-by: Nihantra C. Patel <n.patel.serpentcs@gmail.com>
(cherry picked from commit 71de72b)

Co-authored-by: Solufyin <34390782+Solufyin@users.noreply.github.com>
  • Loading branch information
mergify[bot] and Solufyin authored Mar 11, 2023
1 parent 29c58b6 commit c64836d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions erpnext/crm/doctype/opportunity/opportunity.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ frappe.ui.form.on("Opportunity", {
}
}
});

if (frm.doc.opportunity_from && frm.doc.party_name){
frm.trigger('set_contact_link');
}
},

validate: function(frm) {
Expand Down Expand Up @@ -130,13 +126,19 @@ frappe.ui.form.on("Opportunity", {
} else {
frappe.contacts.clear_address_and_contact(frm);
}

if (frm.doc.opportunity_from && frm.doc.party_name) {
frm.trigger('set_contact_link');
}
},

set_contact_link: function(frm) {
if(frm.doc.opportunity_from == "Customer" && frm.doc.party_name) {
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: 'party_name', doctype: 'Lead'}
} else if (frm.doc.opportunity_from == "Prospect" && frm.doc.party_name) {
frappe.dynamic_link = {doc: frm.doc, fieldname: 'party_name', doctype: 'Prospect'}
}
},

Expand Down

0 comments on commit c64836d

Please sign in to comment.