diff --git a/erpnext/public/js/queries.js b/erpnext/public/js/queries.js index b635adcd44387..b7d880ae408ef 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 e2e0db40449e6..540aca234bd4d 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) {