fix: Set contact filter link in Opportunity (#34325)

fix: Set contact filter link in Opportunity (#34325)

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

Co-authored-by: Solufyin <34390782+Solufyin@users.noreply.github.com>
This commit is contained in:
mergify[bot]
2023-03-11 19:05:26 +05:30
committed by GitHub
parent 29c58b6f75
commit c64836d3d6

View File

@@ -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) { validate: function(frm) {
@@ -130,6 +126,10 @@ frappe.ui.form.on("Opportunity", {
} else { } else {
frappe.contacts.clear_address_and_contact(frm); 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) { set_contact_link: function(frm) {
@@ -137,6 +137,8 @@ frappe.ui.form.on("Opportunity", {
frappe.dynamic_link = {doc: frm.doc, fieldname: 'party_name', 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: 'party_name', doctype: 'Lead'} 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'}
} }
}, },