[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:
@@ -436,14 +436,7 @@ export class SampleServer {
|
|||||||
const groups = arrayGroupBy(records, (record) => {
|
const groups = arrayGroupBy(records, (record) => {
|
||||||
const vals = {};
|
const vals = {};
|
||||||
for (const gb of normalizedGroupBys) {
|
for (const gb of normalizedGroupBys) {
|
||||||
const { fieldName, type } = gb;
|
vals[gb.fieldName] = record[gb.fieldName];
|
||||||
let value;
|
|
||||||
if (["date", "datetime"].includes(type)) {
|
|
||||||
value = this._formatValue(record[fieldName], gb);
|
|
||||||
} else {
|
|
||||||
value = record[fieldName];
|
|
||||||
}
|
|
||||||
vals[fieldName] = value;
|
|
||||||
}
|
}
|
||||||
return JSON.stringify(vals);
|
return JSON.stringify(vals);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user