From 131a16525e11edb2b9c64731fd014357abcd6f0f Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Tue, 22 Nov 2016 13:24:07 +0100 Subject: [PATCH] [FIX] web: pivot cell clicking when no current list/form view When clicking a pivot cell, an action is triggered using the cell data and current action list view and form view. If no list view and/or form view exists for the current viewmanager, the action chooses the default list and/or form view. The fallback when there is no list and/or form view was broken with commit https://github.com/odoo/odoo/commit/002660a9b05cf8620e1c5287a8538ac5e806d59e#diff-9e64efee6e4d81d03c04c0aad259d99cL280, when the views internal data were restructured. Fixes #14392. --- addons/web/static/src/js/views/pivot_view.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/js/views/pivot_view.js b/addons/web/static/src/js/views/pivot_view.js index be63f02248d..a938163e7ff 100644 --- a/addons/web/static/src/js/views/pivot_view.js +++ b/addons/web/static/src/js/views/pivot_view.js @@ -275,9 +275,10 @@ var PivotView = View.extend({ col_domain = this.headers[col_id].domain, context = _.omit(_.clone(this.context), 'group_by'); - var views = _.filter(this.options.action.views, function (view) { - return view[1] === 'form' || view[1] === 'list'; - }); + var views = [ + _find_view_info.call(this, "list"), + _find_view_info.call(this, "form"), + ]; return this.do_action({ type: 'ir.actions.act_window', @@ -290,6 +291,12 @@ var PivotView = View.extend({ context: context, domain: this.domain.concat(row_domain, col_domain), }); + + function _find_view_info(view_type) { + return _.find(this.options.action.views, function (view) { + return view[1] === view_type; + }) || [false, view_type]; + } }, on_measure_row_click: function (event) { var $target = $(event.target),