[IMP] mail: make start method handle hasWebClient parameter properly

startServer method ease data seeding by providing an environment that
can be used to interact with the underlying mock server.The createWebClient
method was not supported well. Indeed, we could either pass serverData or not.
But we could not pass only the views and take the data from the startServer
method. This issue was addressed.

task-2792108

closes odoo/odoo#87432

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
tsm-odoo
2022-03-29 17:23:28 +02:00
parent 68c974dfad
commit 97bd67acc5
@@ -805,12 +805,13 @@ async function start(param0 = {}) {
}),
}, param0.services);
if (!param0.data && !param0.serverData) {
if (!param0.data && (!param0.serverData || !param0.serverData.models)) {
pyEnv = pyEnv || await startServer();
const data = pyEnv.mockServer.data;
Object.assign(data, TEST_USER_IDS);
if (hasWebClient) {
param0.serverData = { models: data };
param0.serverData = param0.serverData || getActionManagerServerData();
param0.serverData.models = data;
} else {
param0.data = data;
}