[IMP] web: manage bool_or and bool_and for boolean in mockServer

Before this commit, the `bool_or` and `bool_and` aggregations are not
managed in the mockServer.

This commit allows to use the `bool_or` and `bool_and` aggregators for
boolean fields in the read_group mock rpc.

task-2702636

Part-of: odoo/odoo#108605
This commit is contained in:
Xavier BOL (xbo)
2023-03-09 20:52:51 +01:00
committed by Xavier Bol (xbo)
parent fc67391f5b
commit 9ae4a0d647
@@ -1069,6 +1069,16 @@ export class MockServer {
}
break;
}
case "boolean": {
if (func === "array_agg") {
group[name] = records.map((r) => r[fieldName]);
} else if (func === "bool_or") {
group[name] = records.some((r) => Boolean(r[fieldName]));
} else if (func === "bool_and") {
group[name] = records.every((r) => Boolean(r[fieldName]));
}
break;
}
}
}
}