diff options
| author | Aaron Bohy <aab@odoo.com> | 2019-09-24 19:56:04 +0000 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2019-09-25 07:20:36 +0000 |
| commit | 1787ff0b52ab409efd91c4888d8d5fd62cbe7981 (patch) | |
| tree | 97dd04057b34aaae1808b1a813554ac06b728a7e /addons/web/static/src/js/views/basic/basic_model.js | |
| parent | 3147e5fada058ec676183b3136145ffe824a9044 (diff) | |
[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 <VincentSchippefilt@users.noreply.github.com>
Diffstat (limited to 'addons/web/static/src/js/views/basic/basic_model.js')
| -rw-r--r-- | addons/web/static/src/js/views/basic/basic_model.js | 8 |
1 files 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 |
