diff options
| author | Thanh Dodeur <tso@odoo.com> | 2019-04-30 10:43:24 +0000 |
|---|---|---|
| committer | Thanh Dodeur <tso@odoo.com> | 2019-05-21 10:33:52 +0000 |
| commit | 923701851e61755a2d0a4df6121fe9b684e13df2 (patch) | |
| tree | fced91252ae9aa4844d8efb43f4449671c3c5aac /addons/web/static/src | |
| parent | 42c41052de655d7f5ab2099b95a718a385f124a3 (diff) | |
[IMP] web: conserves record order in the search panel
After this commit, the order of the elements of the search panel
categories follow the original order received from the back-end.
This is achieved by getting the order from the Array received
from the backend instead of the dictionary used to store the record data.
Task: #1972698
closes odoo/odoo#33358
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/js/views/kanban/search_panel.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/addons/web/static/src/js/views/kanban/search_panel.js b/addons/web/static/src/js/views/kanban/search_panel.js index c3e67032d73..0372d7743a8 100644 --- a/addons/web/static/src/js/views/kanban/search_panel.js +++ b/addons/web/static/src/js/views/kanban/search_panel.js @@ -131,22 +131,24 @@ var SearchPanel = Widget.extend({ var parentField = category.parentField; category.values = {}; - values.forEach(function (value) { + _.each(values, function (value) { category.values[value.id] = _.extend({}, value, { childrenIds: [], folded: true, parentId: value[parentField] && value[parentField][0] || false, }); }); - Object.keys(category.values).forEach(function (valueId) { - var value = category.values[valueId]; + _.map(values, function (value) { + var value = category.values[value.id]; if (value.parentId) { category.values[value.parentId].childrenIds.push(value.id); } }); - category.rootIds = Object.keys(category.values).filter(function (valueId) { - var value = category.values[valueId]; - return value.parentId === false; + category.rootIds = _.filter(_.map(values, function (value) { + return value.id; + }), function (valueId) { + var value = category.values[valueId]; + return value.parentId === false; }); // set active value |
