[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.
This commit is contained in:
Alexandre Kühn
2018-02-20 09:45:52 +01:00
parent d3372e4f8e
commit ae2fa4d0d6
2 changed files with 10 additions and 4 deletions
@@ -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];
}
},
});
+6 -1
View File
@@ -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',