#762 refactor componente fetched tags

This commit is contained in:
Gerard 2018-11-06 09:21:53 +01:00
parent f02f3938dd
commit 6addb2146d
2 changed files with 4 additions and 18 deletions

View File

@ -91,7 +91,7 @@
{{("000000"+sale.itemFk).slice(-6)}}
</span>
</vn-td>
<vn-td><vn-fetched-tags concept="sale.concept" tags="sale.item.tags"/></vn-td>
<vn-td><vn-fetched-tags max-length="6" item="sale.tags"/></vn-td>
<vn-td ng-if="!$ctrl.isEditable" number>{{sale.quantity}}</vn-td>
<vn-td ng-if="$ctrl.isEditable" number>
<vn-textfield

View File

@ -28,22 +28,8 @@ module.exports = Self => {
ids.push(line.itemFk);
let filter = {
fields: ['id'],
where: {id: {inq: ids}},
include: {
relation: 'tags',
scope: {
fields: ['tagFk', 'value', 'priority'],
where: {priority: {lte: 6}},
order: 'priority',
include: {
relation: 'tag',
scope: {
fields: ['name']
}
}
}
}
fields: ['id', 'name', 'tag5', 'value5', 'tag6', 'value6', 'tag7', 'value7', 'tag8', 'value8', 'tag9', 'value9', 'tag10', 'value10'],
where: {id: {inq: ids}}
};
let items = await Self.app.models.Item.find(filter);
@ -52,7 +38,7 @@ module.exports = Self => {
map[item.id] = item;
for (line of lines)
line.item = {tags: map[line.itemFk].tags()};
line.tags = map[line.itemFk];
return lines;
};