[REF] *: add dialogService in setupControlPanelServiceRegistry

From a practical point of view, it seems better to also add the
dialog service in the service registry when calling
setupControlPanelServiceRegistry.

closes odoo/odoo#113610

Related: odoo/enterprise#37510
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
Mathieu Duckerts-Antoine
2023-02-24 14:20:30 +01:00
parent dafb99681d
commit 965fed0cd6
10 changed files with 3 additions and 27 deletions
@@ -1,7 +1,6 @@
/** @odoo-module **/
import { companyService } from "@web/webclient/company_service";
import { dialogService } from "@web/core/dialog/dialog_service";
import { getGraphRenderer } from "@web/../tests/views/graph_view_tests";
import { makeView } from "@web/../tests/views/helpers";
import { patchWithCleanup } from "@web/../tests/helpers/utils";
@@ -37,7 +36,6 @@ QUnit.module('hr_timesheet', function (hooks) {
}
setupControlPanelServiceRegistry();
serviceRegistry.add("company", companyService, { force: true });
serviceRegistry.add("dialog", dialogService);
});
QUnit.module("hr_timesheet_graphview");
@@ -3,7 +3,6 @@
import { browser } from "@web/core/browser/browser";
import { click, getFixture, patchWithCleanup } from "@web/../tests/helpers/utils";
import { setupControlPanelServiceRegistry, toggleGroupByMenu, toggleMenuItem, toggleMenuItemOption } from "@web/../tests/search/helpers";
import { dialogService } from "@web/core/dialog/dialog_service";
import { makeView } from "@web/../tests/views/helpers";
import { registry } from "@web/core/registry";
import { makeFakeNotificationService, fakeCookieService } from "@web/../tests/helpers/mock_services";
@@ -74,7 +73,6 @@ QUnit.module("Project", {}, () => {
registry.category("services").add("notification", makeFakeNotificationService(notificationMock), {
force: true,
});
serviceRegistry.add("dialog", dialogService);
serviceRegistry.add("cookie", fakeCookieService);
});
@@ -14,7 +14,6 @@ import {
toggleSaveFavorite,
} from "@web/../tests/search/helpers";
import { createWebClient, doAction } from "@web/../tests/webclient/helpers";
import { dialogService } from "@web/core/dialog/dialog_service";
import { _lt } from "@web/core/l10n/translation";
import { registry } from "@web/core/registry";
import { ControlPanel } from "@web/search/control_panel/control_panel";
@@ -27,7 +26,6 @@ import { browser } from "@web/core/browser/browser";
import { LegacyComponent } from "@web/legacy/legacy_component";
import { xml } from "@odoo/owl";
const serviceRegistry = registry.category("services");
const viewRegistry = registry.category("views");
let serverData;
@@ -77,7 +75,6 @@ QUnit.module("LegacyViews", (hooks) => {
};
setupControlPanelFavoriteMenuRegistry();
setupControlPanelServiceRegistry();
serviceRegistry.add("dialog", dialogService);
class ToyController extends LegacyComponent {}
ToyController.template = xml`<div class="o_toy_view"><ControlPanel /></div>`;
@@ -2,7 +2,6 @@
import { getFixture, patchWithCleanup, triggerEvent } from "@web/../tests/helpers/utils";
import { browser } from "@web/core/browser/browser";
import { dialogService } from "@web/core/dialog/dialog_service";
import { registry } from "@web/core/registry";
import { ControlPanel } from "@web/search/control_panel/control_panel";
import { FavoriteMenu } from "@web/search/favorite_menu/favorite_menu";
@@ -64,7 +63,6 @@ QUnit.module("Search", (hooks) => {
};
setupControlPanelFavoriteMenuRegistry();
setupControlPanelServiceRegistry();
serviceRegistry.add("dialog", dialogService);
patchWithCleanup(browser, {
setTimeout: (fn) => fn(),
clearTimeout: () => {},
@@ -2,7 +2,6 @@
import { click, getFixture, patchDate } from "@web/../tests/helpers/utils";
import { createWebClient, doAction } from "@web/../tests/webclient/helpers";
import { dialogService } from "@web/core/dialog/dialog_service";
import { registry } from "@web/core/registry";
import { ControlPanel } from "@web/search/control_panel/control_panel";
import { FavoriteMenu } from "@web/search/favorite_menu/favorite_menu";
@@ -20,7 +19,6 @@ import {
} from "@web/../tests/search/helpers";
import { Component, onWillUpdateProps, xml } from "@odoo/owl";
const serviceRegistry = registry.category("services");
const viewRegistry = registry.category("views");
const favoriteMenuRegistry = registry.category("favoriteMenu");
@@ -52,7 +50,6 @@ QUnit.module("Search", (hooks) => {
};
setupControlPanelFavoriteMenuRegistry();
setupControlPanelServiceRegistry();
serviceRegistry.add("dialog", dialogService);
});
QUnit.module("FavoriteMenu");
+3 -1
View File
@@ -10,6 +10,8 @@ import {
nextTick,
triggerEvent,
} from "@web/../tests/helpers/utils";
import { dialogService } from "@web/core/dialog/dialog_service";
import { Component, xml } from "@odoo/owl";
import { hotkeyService } from "@web/core/hotkeys/hotkey_service";
import { notificationService } from "@web/core/notifications/notification_service";
import { ormService } from "@web/core/orm_service";
@@ -20,12 +22,12 @@ import { getDefaultConfig } from "@web/views/view";
import { viewService } from "@web/views/view_service";
import { actionService } from "@web/webclient/actions/action_service";
import { Component, xml } from "@odoo/owl";
const serviceRegistry = registry.category("services");
const favoriteMenuRegistry = registry.category("favoriteMenu");
export function setupControlPanelServiceRegistry() {
serviceRegistry.add("action", actionService);
serviceRegistry.add("dialog", dialogService);
serviceRegistry.add("hotkey", hotkeyService);
serviceRegistry.add("notification", notificationService);
serviceRegistry.add("orm", ormService);
-2
View File
@@ -17,7 +17,6 @@ import {
makeFakeUserService,
} from "../helpers/mock_services";
import { commandService } from "@web/core/commands/command_service";
import { dialogService } from "@web/core/dialog/dialog_service";
import { popoverService } from "@web/core/popover/popover_service";
import { createDebugContext } from "@web/core/debug/debug_context";
@@ -108,7 +107,6 @@ export function setupViewRegistries() {
);
serviceRegistry.add("router", makeFakeRouterService(), { force: true });
serviceRegistry.add("localization", makeFakeLocalizationService()), { force: true };
serviceRegistry.add("dialog", dialogService), { force: true };
serviceRegistry.add("popover", popoverService), { force: true };
serviceRegistry.add("company", fakeCompanyService);
serviceRegistry.add("command", commandService);
@@ -2,8 +2,6 @@
import { getFixture, mount, nextTick } from "@web/../tests/helpers/utils";
import { makeWithSearch, setupControlPanelServiceRegistry } from "@web/../tests/search/helpers";
import { dialogService } from "@web/core/dialog/dialog_service";
import { registry } from "@web/core/registry";
import { Layout } from "@web/search/layout";
import { getDefaultConfig } from "@web/views/view";
import { makeTestEnv } from "@web/../tests/helpers/mock_env";
@@ -12,8 +10,6 @@ import { SearchModel } from "@web/search/search_model";
import { Component, xml, onWillStart, useChildSubEnv, useSubEnv } from "@odoo/owl";
import { useService } from "@web/core/utils/hooks";
const serviceRegistry = registry.category("services");
let target;
let serverData;
@@ -45,7 +41,6 @@ QUnit.module("Views", (hooks) => {
};
setupControlPanelServiceRegistry();
serviceRegistry.add("dialog", dialogService);
target = getFixture();
});
@@ -1,6 +1,5 @@
/** @odoo-module **/
import { dialogService } from "@web/core/dialog/dialog_service";
import { registry } from "@web/core/registry";
import { session } from "@web/session";
import { makeFakeLocalizationService, makeFakeUserService } from "../helpers/mock_services";
@@ -192,7 +191,6 @@ QUnit.module("Views", (hooks) => {
};
setupControlPanelFavoriteMenuRegistry();
setupControlPanelServiceRegistry();
serviceRegistry.add("dialog", dialogService);
serviceRegistry.add("localization", makeFakeLocalizationService());
serviceRegistry.add("user", makeFakeUserService());
patchWithCleanup(browser, { setTimeout: (fn) => fn() });
@@ -9,13 +9,9 @@ import {
} from "@web/../tests/helpers/utils";
import { makeView } from "@web/../tests/views/helpers";
import { createWebClient } from "@web/../tests/webclient/helpers";
import { dialogService } from "@web/core/dialog/dialog_service";
import { registry } from "@web/core/registry";
import { FormViewDialog } from "@web/views/view_dialogs/form_view_dialog";
import { setupControlPanelServiceRegistry } from "@web/../tests/search/helpers";
const serviceRegistry = registry.category("services");
QUnit.module("ViewDialogs", (hooks) => {
let serverData;
let target;
@@ -70,7 +66,6 @@ QUnit.module("ViewDialogs", (hooks) => {
};
target = getFixture();
setupControlPanelServiceRegistry();
serviceRegistry.add("dialog", dialogService);
});
QUnit.module("FormViewDialog");