diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index 2c852e25228b9b2e6d10ae5c5717046d2ca37ad2..fa1e13fd23e7f790ce1733e99c9ac408197e108b 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -206,11 +206,9 @@ def set_address_details( ignore_permissions=False, ): billing_address_field = ( - "customer_address" if party_type == "Lead" else party_type.lower() + "_address" - ) - party_details[billing_address_field] = party_address or get_default_address( - party_type, party.name + "customer_address" if party_type in ["Lead", "Prospect"] else party_type.lower() + "_address" ) + party_details[billing_address_field] = party_address or get_default_address(party_type, party.name) if doctype: party_details.update( get_fetch_values(doctype, billing_address_field, party_details[billing_address_field]) diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 065c5330f84311115083f761d3e9d158447760ce..70558f884a12852ac780f102ee4981d90e0c7fb1 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -73,6 +73,8 @@ frappe.ui.form.on('Quotation', { frm.trigger("set_label"); frm.trigger("toggle_reqd_lead_customer"); frm.trigger("set_dynamic_field_label"); + frm.set_value("party_name", ""); + frm.set_value("customer_name", ""); }, set_label: function(frm) { @@ -101,8 +103,8 @@ erpnext.selling.QuotationController = class QuotationController extends erpnext. super.refresh(doc, dt, dn); frappe.dynamic_link = { doc: this.frm.doc, - fieldname: 'party_name', - doctype: doc.quotation_to == 'Customer' ? 'Customer' : 'Lead', + fieldname: "party_name", + doctype: doc.quotation_to, }; var me = this; @@ -194,6 +196,7 @@ erpnext.selling.QuotationController = class QuotationController extends erpnext. } } else if (this.frm.doc.quotation_to == "Prospect") { this.frm.set_df_property("party_name", "label", "Prospect"); + this.frm.fields_dict.party_name.get_query = null; } }