From 1787ff0b52ab409efd91c4888d8d5fd62cbe7981 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Tue, 24 Sep 2019 19:56:04 +0000 Subject: [PATCH] [FIX] web: don't allow to aggregate date(time) Go to Accounting > Accounting > General ledger. The view is grouped by account. There is a layout issue as the first column (date) is positionned after the group names, leaving a large blank space. This is because the date field is considered as an aggregated field (for sorting purpose, in python), but the JS can't (and we don't want to) display it. This rev. ensures that such field types are completely ignored by the JS, s.t. they do not impact the layout. closes odoo/odoo#37113 Signed-off-by: VincentSchippefilt --- addons/web/static/src/js/views/basic/basic_model.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/views/basic/basic_model.js b/addons/web/static/src/js/views/basic/basic_model.js index 4b4d02c2755..ce8d028d0af 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -94,6 +94,9 @@ var viewUtils = require('web.viewUtils'); var _t = core._t; +// field types that can be aggregated in grouped views +const AGGREGATABLE_TYPES = ['float', 'integer', 'monetary']; + var x2ManyCommands = { // (0, virtualID, {values}) CREATE: 0, @@ -4451,8 +4454,9 @@ var BasicModel = AbstractModel.extend({ _.each(groups, function (group) { var aggregateValues = {}; _.each(group, function (value, key) { - if (_.contains(fields, key) && key !== groupByField) { - aggregateValues[key] = value; + if (_.contains(fields, key) && key !== groupByField && + AGGREGATABLE_TYPES.includes(list.fields[key].type)) { + aggregateValues[key] = value; } }); // When a view is grouped, we need to display the name of each group in