From ae2fa4d0d67ea7b7e7452fe70405ad23cec0cd55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Mon, 19 Feb 2018 12:29:55 +0100 Subject: [PATCH] [FIX] web: pivot controller handles correct views attribute From a recent action manager refactoring (https://github.com/odoo/odoo/commit/32b8cec5361174c92c45a4975d4e02f1fb448aa2), the attribute 'views' in viewOptions is now structured as follow: viewOptions: { action: { views: [{ viewID: 1, type: 'list', }], } } instead of this: viewOptions: { action: { views: [[1, 'list']], } } The pivot view was not updated correctly, so now it should be correct. --- addons/web/static/src/js/views/pivot/pivot_view.js | 7 ++++--- addons/web/static/tests/views/pivot_tests.js | 7 ++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/js/views/pivot/pivot_view.js b/addons/web/static/src/js/views/pivot/pivot_view.js index 0e908f29b8c..0d42fc7bd46 100644 --- a/addons/web/static/src/js/views/pivot/pivot_view.js +++ b/addons/web/static/src/js/views/pivot/pivot_view.js @@ -101,9 +101,10 @@ var PivotView = AbstractView.extend({ _findView(params.action && params.action.views, 'form'), ]; function _findView(views, viewType) { - return _.find(views, function (view) { - return view[1] === viewType; - }) || [false, viewType]; + var view = _.find(views, function (view) { + return view.type === viewType; + }); + return [view ? view.viewID : false, viewType]; } }, }); diff --git a/addons/web/static/tests/views/pivot_tests.js b/addons/web/static/tests/views/pivot_tests.js index 1fcc03ee483..1f89c1fbf9c 100644 --- a/addons/web/static/tests/views/pivot_tests.js +++ b/addons/web/static/tests/views/pivot_tests.js @@ -152,7 +152,12 @@ QUnit.module('Views', { }, viewOptions: { action: { - views: [[2, 'form'], [5, 'kanban'], [false, 'list'], [false, 'pivot']], + views: [ + { viewID: 2, type: 'form' }, + { viewID: 5, type: 'kanban' }, + { viewID: false, type: 'list' }, + { viewID: false, type: 'pivot' }, + ], }, context: {someKey: true, search_default_test: 3}, title: 'Partners',