2
0
mirror of https://github.com/frappe/books.git synced 2024-12-25 12:10:06 +00:00

Get filters from docfield in Link

This commit is contained in:
Faris Ansari 2018-10-23 02:20:50 +05:30
parent b380812c57
commit 058011ebe9

View File

@ -10,13 +10,18 @@ export default {
extends: Autocomplete, extends: Autocomplete,
methods: { methods: {
async getList(query) { 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({ const list = await frappe.db.getAll({
doctype: this.getTarget(), doctype: this.getTarget(),
filters: query filters,
? {
keywords: ['like', query]
}
: null,
fields: ['name'], fields: ['name'],
limit: 50 limit: 50
}); });