Skip to content

Commit ff23dfa

Browse files
committed
web_ir_actions_act_view_reload: rewrite JS code
The button is now in an OWL template https://github.com/odoo/odoo/blob/18.0/addons/mail/static/src/chatter/web/mail_composer_send_dropdown.xml
1 parent a132d32 commit ff23dfa

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

web_ir_actions_act_view_reload/static/src/js/web_ir_actions_act_view_reload.esm.js

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,18 @@
33
// Copyright 2018 Modoolar <info@modoolar.com>
44
// License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
55

6-
import {registry} from "@web/core/registry";
7-
const actionHandlersRegistry = registry.category("action_handlers");
6+
import { registry } from "@web/core/registry";
87

9-
function ir_actions_act_view_reload(args) {
10-
// Odoo v15 is running in "legacy" mode - some of the JS
11-
// is written in Owl, some is still legacy (e.g. controllers
12-
// are still written in the old system - hence below hack)
138

14-
// TODO: for Odoo v16, this will probably need to be re-written in Owl
15-
// REF: https://github.com/odoo/odoo/blob/7054fd6beb4f417efa4b22aafe8b935dd6ade123/addons/web/static/src/webclient/actions/action_service.js#L1257-L1267
9+
export function irActionsActViewReload({ env, action }) {
10+
const currentController = env.services.action.currentController;
1611

17-
const controller = args.env.services.action.currentController;
18-
if (controller) {
19-
const {__legacy_widget__} = controller.getLocalState();
20-
if (__legacy_widget__) {
21-
__legacy_widget__.reload({});
22-
}
12+
if (currentController) {
13+
location.reload();
2314
}
15+
2416
return Promise.resolve();
2517
}
26-
27-
actionHandlersRegistry.add("ir.actions.act_view_reload", ir_actions_act_view_reload);
18+
registry
19+
.category("action_handlers")
20+
.add("ir.actions.act_view_reload", irActionsActViewReload);

0 commit comments

Comments
 (0)