mirror of
https://github.com/frappe/books.git
synced 2024-12-31 22:11:48 +00:00
feat: Group Items in Link field
This commit is contained in:
parent
c2509e4105
commit
fb0744ba2b
@ -5,9 +5,11 @@ module.exports = {
|
||||
{
|
||||
fieldname: 'account',
|
||||
label: 'Account',
|
||||
placeholder: 'Account',
|
||||
fieldtype: 'Link',
|
||||
target: 'Account',
|
||||
required: 1,
|
||||
groupBy: 'rootType',
|
||||
getFilters: () => ({ isGroup: 0 })
|
||||
},
|
||||
{
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user