From 29bbdc9aa5ffba5f20c374b66b0045275c67f0c0 Mon Sep 17 00:00:00 2001 From: Adrien Dieudonne Date: Tue, 17 Sep 2019 13:57:58 +0000 Subject: [PATCH] [IMP] web: PivotView: display grouped columns on mobile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, only "Total" column was shown on mobile and it wasn't possible to add another one. (1) Now, we let the user to add it even if he probably will have to scroll horizontally. (2) The "Flip" button has been reintroduced like in desktop. (3) By default, the old behavior will remain the same (only one colum will be displayed) but to avoid frustrating for users who always have to add manually columns to see the same information as in desktop; you can use favorite filters. In this case, all columns will be displayed. Task ID : 1945893 opw-1935645 closes odoo/odoo#37057 Signed-off-by: Adrien Dieudonné (adr) --- .../src/js/views/pivot/pivot_controller.js | 18 +----------------- .../src/js/views/pivot/pivot_renderer.js | 5 +---- .../static/src/js/views/pivot/pivot_view.js | 1 - 3 files changed, 2 insertions(+), 22 deletions(-) diff --git a/addons/web/static/src/js/views/pivot/pivot_controller.js b/addons/web/static/src/js/views/pivot/pivot_controller.js index 47eb5ad49fe..733a812d328 100644 --- a/addons/web/static/src/js/views/pivot/pivot_controller.js +++ b/addons/web/static/src/js/views/pivot/pivot_controller.js @@ -13,7 +13,6 @@ odoo.define('web.PivotController', function (require) { */ var AbstractController = require('web.AbstractController'); -var config = require('web.config'); var core = require('web.core'); var framework = require('web.framework'); var session = require('web.session'); @@ -115,16 +114,6 @@ var PivotController = AbstractController.extend({ this._updateButtons(); } }, - /** - * @override - * @param {Object} params - */ - update: function (params) { - if (config.device.isMobile && params.context) { - params.context.pivot_column_groupby = []; - } - return this._super.apply(this, arguments); - }, //-------------------------------------------------------------------------- // Private @@ -218,12 +207,7 @@ var PivotController = AbstractController.extend({ .toggleClass('selected', isSelected); }); var noDataDisplayed = !state.hasData || !state.measures.length; - var $flipButton = this.$buttons.find('.o_pivot_flip_button'); - if (config.device.isMobile) { - $flipButton.toggleClass('o_hidden', true); - } else { - $flipButton.prop('disabled', noDataDisplayed); - } + this.$buttons.find('.o_pivot_flip_button').prop('disabled', noDataDisplayed); this.$buttons.find('.o_pivot_expand_button').prop('disabled', noDataDisplayed); this.$buttons.find('.o_pivot_download').prop('disabled', noDataDisplayed); }, diff --git a/addons/web/static/src/js/views/pivot/pivot_renderer.js b/addons/web/static/src/js/views/pivot/pivot_renderer.js index b74b408c877..3affc975225 100644 --- a/addons/web/static/src/js/views/pivot/pivot_renderer.js +++ b/addons/web/static/src/js/views/pivot/pivot_renderer.js @@ -125,10 +125,7 @@ var PivotRenderer = AbstractRenderer.extend({ if (rowIndex > 0) { cellParams.title = groupbyLabels[rowIndex - 1]; } - className = 'o_pivot_header_cell'; - if (!config.device.isMobile) { - className += cell.isLeaf ? '_closed' : '_opened'; - } + className = 'o_pivot_header_cell' + (cell.isLeaf ? '_closed' : '_opened'); } cellParams.class = className; 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 78e7c68cbe6..1b878cf3530 100644 --- a/addons/web/static/src/js/views/pivot/pivot_view.js +++ b/addons/web/static/src/js/views/pivot/pivot_view.js @@ -108,7 +108,6 @@ var PivotView = AbstractView.extend({ this.loadParams.default_order = params.default_order || this.arch.attrs.default_order; if (config.device.isMobile) { this.loadParams.colGroupBys = []; - this.loadParams.context.pivot_column_groupby = []; }