|
3 | 3 | // Copyright 2018 Modoolar <info@modoolar.com> |
4 | 4 | // License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). |
5 | 5 |
|
6 | | -import {registry} from "@web/core/registry"; |
7 | | -const actionHandlersRegistry = registry.category("action_handlers"); |
| 6 | +import { registry } from "@web/core/registry"; |
8 | 7 |
|
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) |
13 | 8 |
|
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; |
16 | 11 |
|
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(); |
23 | 14 | } |
| 15 | + |
24 | 16 | return Promise.resolve(); |
25 | 17 | } |
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