From 058011ebe998921bb191d206a4d90d825fd56430 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Tue, 23 Oct 2018 02:20:50 +0530 Subject: [PATCH] Get filters from docfield in Link --- ui/components/controls/Link.vue | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ui/components/controls/Link.vue b/ui/components/controls/Link.vue index e0de70fd..f37c5b15 100644 --- a/ui/components/controls/Link.vue +++ b/ui/components/controls/Link.vue @@ -10,13 +10,18 @@ export default { extends: Autocomplete, methods: { async getList(query) { + let filters = this.docfield.getFilters ? + this.docfield.getFilters(query) : + null; + + if (query) { + if (!filters) filters = {}; + filters.keywords = ['like', query]; + } + const list = await frappe.db.getAll({ doctype: this.getTarget(), - filters: query - ? { - keywords: ['like', query] - } - : null, + filters, fields: ['name'], limit: 50 });