Skip to content

Commit

Permalink
[MIG] web_ir_actions_act_view_reload: Migration to 15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
foodflo committed Aug 9, 2022
1 parent d0e99dd commit 4d98482
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 60 deletions.
1 change: 1 addition & 0 deletions web_ir_actions_act_view_reload/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
10 changes: 7 additions & 3 deletions web_ir_actions_act_view_reload/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
"name": "Web Actions View Reload",
"summary": "Enables reload of the current view via ActionManager",
"category": "Web",
"version": "14.0.1.0.0",
"version": "15.0.1.0.0",
"license": "LGPL-3",
"author": "Modoolar, CorporateHub, Odoo Community Association (OCA)",
"author": "Modoolar, CorporateHub, Ryan Cole, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/web",
"depends": ["web"],
"data": ["views/web_ir_actions_act_view_reload.xml"],
"installable": True,
"assets": {
"web.assets_backend": [
"web_ir_actions_act_view_reload/static/src/*",
],
},
}
1 change: 1 addition & 0 deletions web_ir_actions_act_view_reload/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import ir_actions_act_view_reload
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from odoo import models


class IrActionsActViewReload(models.Model):
_name = "ir.actions.act_view_reload"
_inherit = "ir.actions.actions"
_description = "View Reload"
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/** @odoo-module **/
// Copyright 2017 - 2018 Modoolar <[email protected]>
// Copyright 2018 Modoolar <[email protected]>
// License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

import {registry} from "@web/core/registry";
const actionHandlersRegistry = registry.category("action_handlers");

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

// TODO: for Odoo v16, this will probably need to be re-written in Owl
// REF: https://github.com/odoo/odoo/blob/7054fd6beb4f417efa4b22aafe8b935dd6ade123/addons/web/static/src/webclient/actions/action_service.js#L1257-L1267

const controller = args.env.services.action.currentController;
if (controller) {
const {__legacy_widget__} = controller.getLocalState();
if (__legacy_widget__) {
__legacy_widget__.reload({});
}
}
return Promise.resolve();
}

actionHandlersRegistry.add("ir.actions.act_view_reload", ir_actions_act_view_reload);

This file was deleted.

This file was deleted.

0 comments on commit 4d98482

Please sign in to comment.