-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate web_ir_actions_act_view_reload to 15.0
- Loading branch information
Showing
8 changed files
with
42 additions
and
52 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
setup/web_ir_actions_act_view_reload/odoo/addons/web_ir_actions_act_view_reload
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../web_ir_actions_act_view_reload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import ir_actions_act_view_reload |
7 changes: 7 additions & 0 deletions
7
web_ir_actions_act_view_reload/models/ir_actions_act_view_reload.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
48 changes: 19 additions & 29 deletions
48
web_ir_actions_act_view_reload/static/src/js/web_ir_actions_act_view_reload.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +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). | ||
odoo.define("web_ir_actions_act_view_reload.ir_actions_act_view_reload", function ( | ||
require | ||
) { | ||
"use strict"; | ||
|
||
var ActionManager = require("web.ActionManager"); | ||
import {registry} from "@web/core/registry"; | ||
const actionHandlersRegistry = registry.category("action_handlers"); | ||
|
||
ActionManager.include({ | ||
/** | ||
* Intercept action handling to detect extra action type | ||
* @override | ||
*/ | ||
_handleAction: function (action, options) { | ||
if (action.type === "ir.actions.act_view_reload") { | ||
return this._executeReloadAction(action, options); | ||
} | ||
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) | ||
|
||
return this._super.apply(this, arguments); | ||
}, | ||
//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 | ||
|
||
/** | ||
* Handle 'ir.actions.act_view_reload' action | ||
* @returns {Promise} Resolved promise | ||
*/ | ||
_executeReloadAction: function () { | ||
var controller = this.getCurrentController(); | ||
if (controller && controller.widget) { | ||
controller.widget.reload(); | ||
} | ||
const controller = args.env.services.action.currentController; | ||
if (controller) { | ||
const {__legacy_widget__} = controller.getLocalState(); | ||
if (__legacy_widget__) { | ||
__legacy_widget__.reload({}) | ||
} | ||
} | ||
return Promise.resolve(); | ||
} | ||
|
||
return Promise.resolve(); | ||
}, | ||
}); | ||
}); | ||
actionHandlersRegistry.add("ir.actions.act_view_reload", ir_actions_act_view_reload); |
20 changes: 0 additions & 20 deletions
20
web_ir_actions_act_view_reload/views/web_ir_actions_act_view_reload.xml
This file was deleted.
Oops, something went wrong.