summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Kühn <aku@odoo.com>2018-02-19 12:29:55 +0100
committerAlexandre Kühn <aku@odoo.com>2018-02-20 09:45:52 +0100
commitae2fa4d0d67ea7b7e7452fe70405ad23cec0cd55 (patch)
treebffdcd5623af6f1cdba45f46d0ca8788a57e4530
parentd3372e4f8eace7ee8dfc37900f74198318662980 (diff)
[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.
-rw-r--r--addons/web/static/src/js/views/pivot/pivot_view.js7
-rw-r--r--addons/web/static/tests/views/pivot_tests.js7
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',