[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>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user