summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorLucas Perais (lpe) <lpe@odoo.com>2019-09-11 12:39:56 +0000
committerLucas Perais (lpe) <lpe@odoo.com>2019-09-12 07:42:38 +0000
commit0fdc914a67bc81d3b9fd64895a3808cb3b46baa7 (patch)
treee03ff08ff8ca8ff2b5a8365b704f24e091df427a /addons/web/static/src
parent9359f5b03667718be2a629c421cdfaa5764fd587 (diff)
[FIX] web: search panel handles archived parent category
Have a model with a parent field Set his parents like Parent 0 | -- Parent 1 | -- Parent 2 Now, put the Parent 1 as inactive Open a view with a search panel, which will fetch the parent field as categories Before this commit, it crashed, because the inner record memory did not contain a reference to the parent of Parent 2 After this commit, it doesn't crash, and the search panel just doesn't display parents categories that are archived, nor any children of those OPW 2070266 closes odoo/odoo#36699 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/views/kanban/search_panel.js5
1 files changed, 3 insertions, 2 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 d06eacbdb07..b7d2432426f 100644
--- a/addons/web/static/src/js/views/kanban/search_panel.js
+++ b/addons/web/static/src/js/views/kanban/search_panel.js
@@ -140,8 +140,9 @@ var SearchPanel = Widget.extend({
});
Object.keys(category.values).forEach(function (valueId) {
var value = category.values[valueId];
- if (value.parentId) {
- category.values[value.parentId].childrenIds.push(value.id);
+ var parentCategoryId = value.parentId;
+ if (parentCategoryId && parentCategoryId in category.values) {
+ category.values[parentCategoryId].childrenIds.push(value.id);
}
});
category.rootIds = Object.keys(category.values).filter(function (valueId) {