From 754e193c7647f7d996d042b13ed19ea962d7e9a5 Mon Sep 17 00:00:00 2001 From: Nihantra Patel Date: Tue, 16 Apr 2024 18:06:42 +0530 Subject: [PATCH 1/5] fix: address filter and quotation to for prospect (cherry picked from commit fe5b88522e8fdc11f64ff0136e41a9c1e18838d1) # Conflicts: # erpnext/selling/doctype/quotation/quotation.js --- erpnext/accounts/party.py | 2 +- erpnext/selling/doctype/quotation/quotation.js | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index 2b95e16f356..27b78d3c3a9 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -188,7 +188,7 @@ def set_address_details( *, ignore_permissions=False, ): - billing_address_field = "customer_address" if party_type == "Lead" else party_type.lower() + "_address" + billing_address_field = "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( diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 2d5c3fa961d..6dcebb082aa 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -45,6 +45,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) { @@ -68,10 +70,23 @@ erpnext.selling.QuotationController = class QuotationController extends erpnext. } refresh(doc, dt, dn) { super.refresh(doc, dt, dn); + let doctype = ""; + if (doc.quotation_to == "Customer") { + doctype = "Customer"; + } else if (doc.quotation_to == "Lead") { + doctype = "Lead"; + } else if (doc.quotation_to == "Prospect") { + doctype = "Prospect"; + } frappe.dynamic_link = { doc: this.frm.doc, +<<<<<<< HEAD fieldname: 'party_name', doctype: doc.quotation_to == 'Customer' ? 'Customer' : 'Lead', +======= + fieldname: "party_name", + doctype: doctype, +>>>>>>> fe5b88522e (fix: address filter and quotation to for prospect) }; var me = this; @@ -170,6 +185,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; } } From 690278042d260f78d2cfd9b72cff809c710becdf Mon Sep 17 00:00:00 2001 From: Nihantra Patel Date: Tue, 16 Apr 2024 18:12:20 +0530 Subject: [PATCH 2/5] fix: address filter and quotation to for prospect (cherry picked from commit 24a68a79dfb284843677f46a9e1f768eead5fcd5) --- erpnext/accounts/party.py | 4 +++- erpnext/selling/doctype/quotation/quotation.js | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index 27b78d3c3a9..8240b79bfdc 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -188,7 +188,9 @@ def set_address_details( *, ignore_permissions=False, ): - billing_address_field = "customer_address" if party_type in ["Lead", "Prospect"] else party_type.lower() + "_address" + billing_address_field = ( + "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( diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 6dcebb082aa..654d96790eb 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -45,8 +45,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", '') + frm.set_value("party_name", "") + frm.set_value("customer_name", "") }, set_label: function(frm) { From c9e7f450c5d771c0469214d22f68be947ec30775 Mon Sep 17 00:00:00 2001 From: Nihantra Patel Date: Tue, 16 Apr 2024 18:13:49 +0530 Subject: [PATCH 3/5] fix: address filter and quotation to for prospect (cherry picked from commit 2896e3666c4f034912e3d0046c0036a6f0512a73) --- erpnext/selling/doctype/quotation/quotation.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 654d96790eb..37c80da95ca 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -45,8 +45,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", "") + frm.set_value("party_name", ""); + frm.set_value("customer_name", ""); }, set_label: function(frm) { From c4dfcbec96b4df318fd140e6b50c3ecd8c195854 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 9 May 2024 11:58:33 +0530 Subject: [PATCH 4/5] refactor: make use of doc.quotation_to (cherry picked from commit 754c7f6d1ca0e20d5673dea79b15097e5c66ea3b) # Conflicts: # erpnext/selling/doctype/quotation/quotation.js --- erpnext/selling/doctype/quotation/quotation.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 37c80da95ca..1dc6e7f27da 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -70,14 +70,6 @@ erpnext.selling.QuotationController = class QuotationController extends erpnext. } refresh(doc, dt, dn) { super.refresh(doc, dt, dn); - let doctype = ""; - if (doc.quotation_to == "Customer") { - doctype = "Customer"; - } else if (doc.quotation_to == "Lead") { - doctype = "Lead"; - } else if (doc.quotation_to == "Prospect") { - doctype = "Prospect"; - } frappe.dynamic_link = { doc: this.frm.doc, <<<<<<< HEAD @@ -85,8 +77,12 @@ erpnext.selling.QuotationController = class QuotationController extends erpnext. doctype: doc.quotation_to == 'Customer' ? 'Customer' : 'Lead', ======= fieldname: "party_name", +<<<<<<< HEAD doctype: doctype, >>>>>>> fe5b88522e (fix: address filter and quotation to for prospect) +======= + doctype: doc.quotation_to, +>>>>>>> 754c7f6d1c (refactor: make use of doc.quotation_to) }; var me = this; From 0404941fb2925f585c94015ae573a88f043ca75c Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 9 May 2024 12:21:29 +0530 Subject: [PATCH 5/5] chore: resolve conflict --- erpnext/selling/doctype/quotation/quotation.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 1dc6e7f27da..d2f565ef70e 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -72,17 +72,8 @@ erpnext.selling.QuotationController = class QuotationController extends erpnext. super.refresh(doc, dt, dn); frappe.dynamic_link = { doc: this.frm.doc, -<<<<<<< HEAD fieldname: 'party_name', - doctype: doc.quotation_to == 'Customer' ? 'Customer' : 'Lead', -======= - fieldname: "party_name", -<<<<<<< HEAD - doctype: doctype, ->>>>>>> fe5b88522e (fix: address filter and quotation to for prospect) -======= doctype: doc.quotation_to, ->>>>>>> 754c7f6d1c (refactor: make use of doc.quotation_to) }; var me = this;