diff --git a/addons/web/static/src/legacy/utils.js b/addons/web/static/src/legacy/utils.js index 49ab4cfb31b..8dd659be439 100644 --- a/addons/web/static/src/legacy/utils.js +++ b/addons/web/static/src/legacy/utils.js @@ -208,26 +208,6 @@ export function makeLegacyRPCService(legacyEnv) { }; } -export function useLegacyRefs() { - const env = owl.useEnv(); - - let legacyRefs; - if (env.legacyRefs) { - legacyRefs = env.legacyRefs; - } else { - legacyRefs = { - component: null, - widget: null, - }; - } - - owl.useChildSubEnv({ - legacyRefs, - }); - - return legacyRefs; -} - /** * This hook allows legacy owl Components to use services coming from the wowl env. * @param {string} serviceName diff --git a/addons/web/static/src/webclient/actions/action_dialog.js b/addons/web/static/src/webclient/actions/action_dialog.js index 0ff32a1c475..126fd9f8a94 100644 --- a/addons/web/static/src/webclient/actions/action_dialog.js +++ b/addons/web/static/src/webclient/actions/action_dialog.js @@ -3,21 +3,10 @@ import { Dialog } from "@web/core/dialog/dialog"; import { DebugMenu } from "@web/core/debug/debug_menu"; import { useOwnDebugContext } from "@web/core/debug/debug_context"; -import { useLegacyRefs } from "@web/legacy/utils"; import { useEffect } from "@odoo/owl"; -const LEGACY_SIZE_CLASSES = { - "extra-large": "xl", - large: "lg", - medium: "md", - small: "sm", -}; - -// ----------------------------------------------------------------------------- -// Action Dialog (Component) -// ----------------------------------------------------------------------------- -class ActionDialog extends Dialog { +export class ActionDialog extends Dialog { setup() { super.setup(); useOwnDebugContext(); @@ -49,35 +38,3 @@ ActionDialog.defaultProps = { ...Dialog.defaultProps, withBodyPadding: false, }; - -/** - * This LegacyAdaptedActionDialog class will disappear when legacy code will be entirely rewritten. - * The "ActionDialog" class should get exported from this file when the cleaning will occur, and it - * should stop extending Dialog and use it normally instead at that point. - */ -class LegacyAdaptedActionDialog extends ActionDialog { - setup() { - super.setup(); - const actionProps = this.props && this.props.actionProps; - const actionContext = actionProps && actionProps.context; - const actionDialogSize = actionContext && actionContext.dialog_size; - this.props.size = LEGACY_SIZE_CLASSES[actionDialogSize] || Dialog.defaultProps.size; - const ControllerComponent = this.props && this.props.ActionComponent; - const Controller = ControllerComponent && ControllerComponent.Component; - this.isLegacy = Controller && Controller.isLegacy; - const legacyRefs = useLegacyRefs(); - useEffect( - () => { - if (this.isLegacy) { - // Render legacy footer buttons - const footer = this.modalRef.el.querySelector("footer"); - legacyRefs.widget.renderButtons($(footer)); - } - }, - () => [] - ); - } -} -LegacyAdaptedActionDialog.template = "web.LegacyAdaptedActionDialog"; - -export { LegacyAdaptedActionDialog as ActionDialog }; diff --git a/addons/web/static/src/webclient/actions/action_dialog.xml b/addons/web/static/src/webclient/actions/action_dialog.xml index 8775f13daae..14cf92ba409 100644 --- a/addons/web/static/src/webclient/actions/action_dialog.xml +++ b/addons/web/static/src/webclient/actions/action_dialog.xml @@ -23,14 +23,4 @@ - - - - - - - - - - diff --git a/addons/web/static/src/webclient/actions/action_service.js b/addons/web/static/src/webclient/actions/action_service.js index 6f2fce4f2cb..11c29947430 100644 --- a/addons/web/static/src/webclient/actions/action_service.js +++ b/addons/web/static/src/webclient/actions/action_service.js @@ -93,6 +93,13 @@ function parseActiveIds(ids) { return activeIds; } +const DIALOG_SIZES = { + "extra-large": "xl", + large: "lg", + medium: "md", + small: "sm", +}; + // ----------------------------------------------------------------------------- // Errors // ----------------------------------------------------------------------------- @@ -775,7 +782,6 @@ function makeActionManager(env) { if (action.target === "new") { cleanDomFromBootstrap(); const actionDialogProps = { - // TODO add size ActionComponent: ControllerComponent, actionProps: controller.props, actionType: action.type, @@ -783,6 +789,10 @@ function makeActionManager(env) { if (action.name) { actionDialogProps.title = action.name; } + const size = DIALOG_SIZES[action.context.dialog_size]; + if (size) { + actionDialogProps.size = size; + } const onClose = _removeDialog(); removeDialogFn = env.services.dialog.add(ActionDialog, actionDialogProps, {