[FIX] web, mail: indirectly call a patched function
The commit [1] removed two async module and caused a reorganisation on the module loading. Since that commit, the patches could be applied in a different order and be applied after a save of one these patches. This commit fixes a case where we save the reference of a patched function that we call it later with missing patches. [1]: 96687f29496ab4cf16ae2ab1584ef1a6a3fb4a11 Part-of: odoo/odoo#121185
This commit is contained in:
@@ -16,12 +16,11 @@ import { registerCleanup } from "@web/../tests/helpers/cleanup";
|
||||
import {
|
||||
clearRegistryWithCleanup,
|
||||
registryNamesToCloneWithCleanup,
|
||||
utils,
|
||||
prepareRegistriesWithCleanup,
|
||||
} from "@web/../tests/helpers/mock_env";
|
||||
import { getFixture, makeDeferred, patchWithCleanup } from "@web/../tests/helpers/utils";
|
||||
import { doAction, getActionManagerServerData } from "@web/../tests/webclient/helpers";
|
||||
|
||||
const { prepareRegistriesWithCleanup } = utils;
|
||||
const { afterNextRender } = App;
|
||||
|
||||
// load emoji data once, when the test suite starts.
|
||||
|
||||
@@ -10,7 +10,7 @@ import { uiService } from "@web/core/ui/ui_service";
|
||||
import { useSetupView } from "@web/views/view_hook";
|
||||
import { ActionDialog } from "@web/webclient/actions/action_dialog";
|
||||
import { hotkeyService } from "@web/core/hotkeys/hotkey_service";
|
||||
import { makeTestEnv, utils } from "../../helpers/mock_env";
|
||||
import { makeTestEnv, prepareRegistriesWithCleanup } from "../../helpers/mock_env";
|
||||
import {
|
||||
fakeCompanyService,
|
||||
fakeCommandService,
|
||||
@@ -33,7 +33,6 @@ import { editSearchView, editView, setDefaults, viewMetadata } from "@web/views/
|
||||
import { fieldService } from "@web/core/field_service";
|
||||
|
||||
import { Component, xml } from "@odoo/owl";
|
||||
const { prepareRegistriesWithCleanup } = utils;
|
||||
|
||||
export class DebugMenuParent extends Component {
|
||||
setup() {
|
||||
|
||||
@@ -60,36 +60,38 @@ export const registryNamesToCloneWithCleanup = [
|
||||
"wowlToLegacyServiceMappers",
|
||||
];
|
||||
|
||||
function prepareRegistriesWithCleanup() {
|
||||
// Clone registries
|
||||
registryNamesToCloneWithCleanup.forEach((registryName) =>
|
||||
cloneRegistryWithCleanup(registry.category(registryName))
|
||||
);
|
||||
export const utils = {
|
||||
prepareRegistriesWithCleanup() {
|
||||
// Clone registries
|
||||
registryNamesToCloneWithCleanup.forEach((registryName) =>
|
||||
cloneRegistryWithCleanup(registry.category(registryName))
|
||||
);
|
||||
|
||||
// Clear registries
|
||||
clearRegistryWithCleanup(registry.category("command_categories"));
|
||||
clearRegistryWithCleanup(registry.category("debug"));
|
||||
clearRegistryWithCleanup(registry.category("error_dialogs"));
|
||||
clearRegistryWithCleanup(registry.category("favoriteMenu"));
|
||||
clearRegistryWithCleanup(registry.category("ir.actions.report handlers"));
|
||||
clearRegistryWithCleanup(registry.category("main_components"));
|
||||
clearRegistryWithCleanup(registry.category("wowlToLegacyServiceMappers"));
|
||||
// Clear registries
|
||||
clearRegistryWithCleanup(registry.category("command_categories"));
|
||||
clearRegistryWithCleanup(registry.category("debug"));
|
||||
clearRegistryWithCleanup(registry.category("error_dialogs"));
|
||||
clearRegistryWithCleanup(registry.category("favoriteMenu"));
|
||||
clearRegistryWithCleanup(registry.category("ir.actions.report handlers"));
|
||||
clearRegistryWithCleanup(registry.category("main_components"));
|
||||
clearRegistryWithCleanup(registry.category("wowlToLegacyServiceMappers"));
|
||||
|
||||
clearRegistryWithCleanup(registry.category("services"));
|
||||
clearServicesMetadataWithCleanup();
|
||||
clearRegistryWithCleanup(registry.category("services"));
|
||||
clearServicesMetadataWithCleanup();
|
||||
|
||||
clearRegistryWithCleanup(registry.category("systray"));
|
||||
clearRegistryWithCleanup(registry.category("user_menuitems"));
|
||||
clearRegistryWithCleanup(registry.category("kanban_examples"));
|
||||
clearRegistryWithCleanup(registry.category("__processed_archs__"));
|
||||
// fun fact: at least one registry is missing... this shows that we need a
|
||||
// better design for the way we clear these registries...
|
||||
}
|
||||
clearRegistryWithCleanup(registry.category("systray"));
|
||||
clearRegistryWithCleanup(registry.category("user_menuitems"));
|
||||
clearRegistryWithCleanup(registry.category("kanban_examples"));
|
||||
clearRegistryWithCleanup(registry.category("__processed_archs__"));
|
||||
// fun fact: at least one registry is missing... this shows that we need a
|
||||
// better design for the way we clear these registries...
|
||||
},
|
||||
};
|
||||
|
||||
// This is exported in a utils object to allow for patching
|
||||
export const utils = {
|
||||
prepareRegistriesWithCleanup,
|
||||
};
|
||||
export function prepareRegistriesWithCleanup() {
|
||||
return utils.prepareRegistriesWithCleanup();
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {import("@web/env").OdooEnv} OdooEnv
|
||||
|
||||
@@ -8,7 +8,7 @@ import { browser, makeRAMLocalStorage } from "@web/core/browser/browser";
|
||||
import { nextTick, patchTimeZone, patchWithCleanup } from "@web/../tests/helpers/utils";
|
||||
import { memoize } from "@web/core/utils/functions";
|
||||
import { registerCleanup } from "./helpers/cleanup";
|
||||
import { utils } from "./helpers/mock_env";
|
||||
import { prepareRegistriesWithCleanup } from "./helpers/mock_env";
|
||||
import { session as sessionInfo } from "@web/session";
|
||||
import { config as transitionConfig } from "@web/core/transition";
|
||||
import { loadLanguages } from "@web/core/l10n/translation";
|
||||
@@ -20,8 +20,6 @@ import { App, whenReady } from "@odoo/owl";
|
||||
import { currencies } from "@web/core/currency";
|
||||
import "./helpers/session";
|
||||
|
||||
const { prepareRegistriesWithCleanup } = utils;
|
||||
|
||||
function stringifyObjectValues(obj, properties) {
|
||||
let res = "";
|
||||
for (const dotted of properties) {
|
||||
|
||||
Reference in New Issue
Block a user