[IMP] web: PivotView: display grouped columns on mobile
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) <adr@odoo.com>
This commit is contained in:
@@ -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);
|
||||
},
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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 = [];
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user