diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index f86dd8f57ee..e606308a1b9 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -647,12 +647,12 @@ def set_taxes( else: args.update(get_party_details(party, party_type)) - if party_type in ("Customer", "Lead"): + if party_type in ("Customer", "Lead", "Prospect"): args.update({"tax_type": "Sales"}) - if party_type == "Lead": + if party_type in ["Lead", "Prospect"]: args["customer"] = None - del args["lead"] + del args[frappe.scrub(party_type)] else: args.update({"tax_type": "Purchase"}) diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index d3195332d14..6f1a50dab1e 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -43,7 +43,6 @@ class SellingController(StockController): self.set_serial_and_batch_bundle(table_field) def set_missing_values(self, for_validate=False): - super(SellingController, self).set_missing_values(for_validate) # set contact and address details for customer, if they are not mentioned @@ -62,7 +61,7 @@ class SellingController(StockController): elif self.doctype == "Quotation" and self.party_name: if self.quotation_to == "Customer": customer = self.party_name - else: + elif self.quotation_to == "Lead": lead = self.party_name if customer: diff --git a/erpnext/public/js/utils/party.js b/erpnext/public/js/utils/party.js index 644adff1e27..5c41aa06804 100644 --- a/erpnext/public/js/utils/party.js +++ b/erpnext/public/js/utils/party.js @@ -16,8 +16,8 @@ erpnext.utils.get_party_details = function(frm, method, args, callback) { || (frm.doc.party_name && in_list(['Quotation', 'Opportunity'], frm.doc.doctype))) { let party_type = "Customer"; - if (frm.doc.quotation_to && frm.doc.quotation_to === "Lead") { - party_type = "Lead"; + if (frm.doc.quotation_to && in_list(["Lead", "Prospect"], frm.doc.quotation_to)) { + party_type = frm.doc.quotation_to; } args = { diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 83fa472d68b..2d5c3fa961d 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -13,7 +13,7 @@ frappe.ui.form.on('Quotation', { frm.set_query("quotation_to", function() { return{ "filters": { - "name": ["in", ["Customer", "Lead"]], + "name": ["in", ["Customer", "Lead", "Prospect"]], } } }); @@ -160,19 +160,16 @@ erpnext.selling.QuotationController = class QuotationController extends erpnext. } set_dynamic_field_label(){ - if (this.frm.doc.quotation_to == "Customer") - { + if (this.frm.doc.quotation_to == "Customer") { this.frm.set_df_property("party_name", "label", "Customer"); this.frm.fields_dict.party_name.get_query = null; - } - - if (this.frm.doc.quotation_to == "Lead") - { + } else if (this.frm.doc.quotation_to == "Lead") { this.frm.set_df_property("party_name", "label", "Lead"); - this.frm.fields_dict.party_name.get_query = function() { return{ query: "erpnext.controllers.queries.lead_query" } } + } else if (this.frm.doc.quotation_to == "Prospect") { + this.frm.set_df_property("party_name", "label", "Prospect"); } }