diff --git a/addons/web/static/src/legacy/action_adapters.js b/addons/web/static/src/legacy/action_adapters.js
index b8b7ad46a79..a1cd4bf400c 100644
--- a/addons/web/static/src/legacy/action_adapters.js
+++ b/addons/web/static/src/legacy/action_adapters.js
@@ -31,6 +31,9 @@ class ActionAdapter extends ComponentAdapter {
let originalUpdateControlPanel;
useEffect(
() => {
+ if (this.wowlEnv.setLegacyControllerWidget) {
+ this.wowlEnv.setLegacyControllerWidget(this.widget);
+ }
const query = this.widget.getState();
Object.assign(query, this.tempQuery);
this.tempQuery = null;
diff --git a/addons/web/static/src/webclient/actions/action_dialog.js b/addons/web/static/src/webclient/actions/action_dialog.js
index 97630c2e11b..591d71d1808 100644
--- a/addons/web/static/src/webclient/actions/action_dialog.js
+++ b/addons/web/static/src/webclient/actions/action_dialog.js
@@ -5,7 +5,7 @@ import { DebugMenu } from "@web/core/debug/debug_menu";
import { useOwnDebugContext } from "@web/core/debug/debug_context";
import { useEffect } from "@web/core/utils/hooks";
-const { useRef } = owl;
+const { useSubEnv } = owl;
const LEGACY_SIZE_CLASSES = {
"extra-large": "modal-xl",
@@ -20,7 +20,6 @@ class ActionDialog extends Dialog {
setup() {
super.setup();
useOwnDebugContext();
- this.actionRef = useRef("actionRef");
const actionProps = this.props && this.props.actionProps;
const action = actionProps && actionProps.action;
this.actionType = action && action.type;
@@ -52,21 +51,23 @@ class LegacyAdaptedActionDialog extends ActionDialog {
const ControllerComponent = this.props && this.props.ActionComponent;
const Controller = ControllerComponent && ControllerComponent.Component;
this.isLegacy = Controller && Controller.isLegacy;
+ if (this.isLegacy) {
+ useSubEnv({
+ setLegacyControllerWidget: (widget) => {
+ this.legacyController = widget;
+ },
+ });
+ }
useEffect(
() => {
if (this.isLegacy) {
- // Retrieve the widget climbing the wrappers
- const componentController = this.actionRef.comp;
- const controller = componentController.componentRef.comp;
- const viewAdapter = controller.controllerRef.comp;
- const widget = viewAdapter.widget;
// Render legacy footer buttons
const footer = this.modalRef.el.querySelector("footer");
- widget.renderButtons($(footer));
+ this.legacyController.renderButtons($(footer));
}
},
() => []
- ); // TODO: should this depend on actionRef.comp?
+ );
}
}
LegacyAdaptedActionDialog.footerTemplate = "web.LegacyAdaptedActionDialogFooter";
diff --git a/addons/web/static/src/webclient/actions/action_dialog.xml b/addons/web/static/src/webclient/actions/action_dialog.xml
index d944772cc57..9238bd9687d 100644
--- a/addons/web/static/src/webclient/actions/action_dialog.xml
+++ b/addons/web/static/src/webclient/actions/action_dialog.xml
@@ -13,7 +13,7 @@
-
+
diff --git a/addons/web/static/src/webclient/actions/action_service.js b/addons/web/static/src/webclient/actions/action_service.js
index ed519c31427..54a4ac7ba5b 100644
--- a/addons/web/static/src/webclient/actions/action_service.js
+++ b/addons/web/static/src/webclient/actions/action_service.js
@@ -14,7 +14,7 @@ import { View } from "@web/views/view";
import { ActionDialog } from "./action_dialog";
import { CallbackRecorder } from "./action_hook";
-const { Component, useRef, useSubEnv, xml } = owl;
+const { Component, useSubEnv, xml } = owl;
const actionHandlersRegistry = registry.category("action_handlers");
const actionRegistry = registry.category("actions");
@@ -73,9 +73,7 @@ export class InvalidButtonParamsError extends Error {}
const CTX_KEY_REGEX = /^(?:(?:default_|search_default_|show_).+|.+_view_ref|group_by|group_by_no_leaf|active_id|active_ids|orderedBy)$/;
// only register this template once for all dynamic classes ControllerComponent
-const ControllerComponentTemplate = xml``;
+const ControllerComponentTemplate = xml``;
function makeActionManager(env) {
const keepLast = new KeepLast();
@@ -551,7 +549,6 @@ function makeActionManager(env) {
class ControllerComponent extends Component {
setup() {
this.Component = controller.Component;
- this.componentRef = useRef("component");
this.titleService = useService("title");
useDebugCategory("action", { action });
useSubEnv({ config: controller.config });