diff --git a/models/doctype/JournalEntryAccount/JournalEntryAccount.js b/models/doctype/JournalEntryAccount/JournalEntryAccount.js index d5dcc7c7..45c9f36c 100644 --- a/models/doctype/JournalEntryAccount/JournalEntryAccount.js +++ b/models/doctype/JournalEntryAccount/JournalEntryAccount.js @@ -5,9 +5,11 @@ module.exports = { { fieldname: 'account', label: 'Account', + placeholder: 'Account', fieldtype: 'Link', target: 'Account', required: 1, + groupBy: 'rootType', getFilters: () => ({ isGroup: 0 }) }, { diff --git a/src/components/Controls/Link.vue b/src/components/Controls/Link.vue index 1a124075..15bb9f7f 100644 --- a/src/components/Controls/Link.vue +++ b/src/components/Controls/Link.vue @@ -19,13 +19,22 @@ export default { doctype, filters, fields: [ - ...new Set(['name', meta.titleField, ...meta.getKeywordFields()]) - ] + ...new Set([ + 'name', + meta.titleField, + this.df.groupBy, + ...meta.getKeywordFields() + ]) + ].filter(Boolean) }); let createNewOption = this.getCreateNewOption(); let suggestions = results .map(r => { - return { label: r[meta.titleField], value: r.name }; + let option = { label: r[meta.titleField], value: r.name }; + if (this.df.groupBy) { + option.group = r[this.df.groupBy]; + } + return option; }) .concat(this.df.disableCreation ? null : createNewOption) .filter(Boolean);