fix: Unable to change link from new lead to existing customer (#22787)

* Unable to change link from new lead to existing customer

* Unable to change link from new lead to existing customer

Co-authored-by: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com>
This commit is contained in:
Anupam Kumar 2020-07-23 16:30:56 +05:30 committed by GitHub
parent 7137b0b670
commit 04a76285e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 13 deletions

View File

@ -30,7 +30,6 @@ frappe.ui.form.on("Opportunity", {
},
party_name: function(frm) {
frm.toggle_display("contact_info", frm.doc.party_name);
frm.trigger('set_contact_link');
if (frm.doc.opportunity_from == "Customer") {
@ -48,10 +47,6 @@ frappe.ui.form.on("Opportunity", {
frm.get_field("items").grid.set_multiple_add("item_code", "qty");
},
with_items: function(frm) {
frm.trigger('toggle_mandatory');
},
customer_address: function(frm, cdt, cdn) {
erpnext.utils.get_address_display(frm, 'customer_address', 'address_display', false);
},
@ -59,15 +54,19 @@ frappe.ui.form.on("Opportunity", {
contact_person: erpnext.utils.get_contact_details,
opportunity_from: function(frm) {
frm.trigger('setup_opportunity_from');
frm.set_value("party_name", "");
},
setup_opportunity_from: function(frm) {
frm.trigger('setup_queries');
frm.toggle_reqd("party_name", frm.doc.opportunity_from);
frm.trigger("set_dynamic_field_label");
},
refresh: function(frm) {
var doc = frm.doc;
frm.events.opportunity_from(frm);
frm.trigger('toggle_mandatory');
frm.trigger('setup_opportunity_from');
erpnext.toggle_naming_series();
if(!doc.__islocal && doc.status!=="Lost") {
@ -118,7 +117,6 @@ frappe.ui.form.on("Opportunity", {
},
set_dynamic_field_label: function(frm){
if (frm.doc.opportunity_from) {
frm.set_df_property("party_name", "label", frm.doc.opportunity_from);
}
@ -138,9 +136,6 @@ frappe.ui.form.on("Opportunity", {
})
},
toggle_mandatory: function(frm) {
frm.toggle_reqd("items", frm.doc.with_items ? 1:0);
}
})
// TODO commonify this code

View File

@ -254,6 +254,7 @@
"fieldname": "items",
"fieldtype": "Table",
"label": "Items",
"mandatory_depends_on": "eval: doc.with_items == 1",
"oldfieldname": "enquiry_details",
"oldfieldtype": "Table",
"options": "Opportunity Item"
@ -423,7 +424,7 @@
"icon": "fa fa-info-sign",
"idx": 195,
"links": [],
"modified": "2020-04-07 09:05:39.391109",
"modified": "2020-07-14 16:49:15.888503",
"modified_by": "Administrator",
"module": "CRM",
"name": "Opportunity",