From e3831c56650625e8079a97be8ad5026fe18b3390 Mon Sep 17 00:00:00 2001 From: Subin Tom <36098155+nemesis189@users.noreply.github.com> Date: Tue, 21 Dec 2021 12:35:44 +0530 Subject: [PATCH] fix: Added filter for dispatch address (#28937) --- erpnext/public/js/queries.js | 7 +++++++ erpnext/selling/sales_common.js | 1 + 2 files changed, 8 insertions(+) diff --git a/erpnext/public/js/queries.js b/erpnext/public/js/queries.js index b635adcd4438..b7d880ae408e 100644 --- a/erpnext/public/js/queries.js +++ b/erpnext/public/js/queries.js @@ -83,6 +83,13 @@ $.extend(erpnext.queries, { }; }, + dispatch_address_query: function(doc) { + return { + query: 'frappe.contacts.doctype.address.address.address_query', + filters: { link_doctype: 'Company', link_name: doc.company || '' } + }; + }, + supplier_filter: function(doc) { if(!doc.supplier) { frappe.throw(__("Please set {0}", [__(frappe.meta.get_label(doc.doctype, "supplier", doc.name))])); diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js index e2e0db40449e..540aca234bd4 100644 --- a/erpnext/selling/sales_common.js +++ b/erpnext/selling/sales_common.js @@ -41,6 +41,7 @@ erpnext.selling.SellingController = class SellingController extends erpnext.Tran me.frm.set_query('contact_person', erpnext.queries.contact_query); me.frm.set_query('customer_address', erpnext.queries.address_query); me.frm.set_query('shipping_address_name', erpnext.queries.address_query); + me.frm.set_query('dispatch_address_name', erpnext.queries.dispatch_address_query); if(this.frm.fields_dict.selling_price_list) {