[REF] web: sample server: _mockReadGroup

The function used to group fake records in _mockReadGroup was
overcomplicated. We simplify it.

closes odoo/odoo#108921

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
Mathieu Duckerts-Antoine
2023-01-03 14:33:00 +01:00
parent 17ad50275c
commit 8d437bf561
+1 -8
View File
@@ -436,14 +436,7 @@ export class SampleServer {
const groups = arrayGroupBy(records, (record) => {
const vals = {};
for (const gb of normalizedGroupBys) {
const { fieldName, type } = gb;
let value;
if (["date", "datetime"].includes(type)) {
value = this._formatValue(record[fieldName], gb);
} else {
value = record[fieldName];
}
vals[fieldName] = value;
vals[gb.fieldName] = record[gb.fieldName];
}
return JSON.stringify(vals);
});