diff --git a/erpnext/public/js/utils/party.js b/erpnext/public/js/utils/party.js index eab04006c21..5869c4da4c2 100644 --- a/erpnext/public/js/utils/party.js +++ b/erpnext/public/js/utils/party.js @@ -103,7 +103,7 @@ erpnext.utils.get_address_display = function(frm, address_field, display_field, erpnext.utils.set_taxes = function(frm, address_field, display_field, is_your_company_address) { if(frappe.meta.get_docfield(frm.doc.doctype, "taxes") && !is_your_company_address) { if(!erpnext.utils.validate_mandatory(frm, "Lead/Customer/Supplier", - frm.doc.customer || frm.doc.supplier || frm.doc.lead, address_field)) { + frm.doc.customer || frm.doc.supplier || frm.doc.lead || frm.doc.party_name , address_field)) { return; } @@ -125,6 +125,9 @@ erpnext.utils.set_taxes = function(frm, address_field, display_field, is_your_co } else if (frm.doc.supplier) { party_type = 'Supplier'; party = frm.doc.supplier; + } else if (frm.doc.quotation_to){ + party_type = frm.doc.quotation_to; + party = frm.doc.party_name; } frappe.call({ diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 3116e65b686..397c853097b 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -127,14 +127,24 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ // to overwrite the customer_filter trigger from queries.js this.frm.toggle_reqd("party_name", this.frm.doc.quotation_to); - this.frm.set_query('customer_address', erpnext.queries.address_query); - this.frm.set_query('shipping_address_name', erpnext.queries.address_query); + this.frm.set_query('customer_address', this.address_query); + this.frm.set_query('shipping_address_name', this.address_query); }, tc_name: function() { this.get_terms(); }, + address_query: function(doc) { + return { + query: 'frappe.contacts.doctype.address.address.address_query', + filters: { + link_doctype: frappe.dynamic_link.doctype, + link_name: doc.party_name + } + }; + }, + validate_company_and_party: function(party_field) { if(!this.frm.doc.quotation_to) { frappe.msgprint(__("Please select a value for {0} quotation_to {1}", [this.frm.doc.doctype, this.frm.doc.name])); diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json index 4b247075451..bbb84e2e33e 100644 --- a/erpnext/selling/doctype/quotation/quotation.json +++ b/erpnext/selling/doctype/quotation/quotation.json @@ -441,7 +441,7 @@ "collapsible": 1, "collapsible_depends_on": "", "columns": 0, - "depends_on": "eval:(doc.customer || doc.lead)", + "depends_on": "eval:doc.party_name", "fetch_if_empty": 0, "fieldname": "contact_section", "fieldtype": "Section Break", @@ -542,7 +542,7 @@ "bold": 0, "collapsible": 0, "columns": 0, - "depends_on": "eval:doc.customer", + "depends_on": "eval:doc.quotaion_to=='Customer' && doc.party_name", "fetch_if_empty": 0, "fieldname": "contact_person", "fieldtype": "Link", @@ -3224,7 +3224,7 @@ "istable": 0, "max_attachments": 1, "menu_index": 0, - "modified": "2019-04-25 15:26:21.983298", + "modified": "2019-05-02 14:10:43.355616", "modified_by": "Administrator", "module": "Selling", "name": "Quotation",