diff --git a/web_ir_actions_act_window_message/README.rst b/web_ir_actions_act_window_message/README.rst index 0c7c55e06..abf253627 100644 --- a/web_ir_actions_act_window_message/README.rst +++ b/web_ir_actions_act_window_message/README.rst @@ -23,7 +23,7 @@ Client side message boxes :target: https://runbot.odoo-community.org/runbot/162/13.0 :alt: Try me on Runbot -|badge1| |badge2| |badge3| |badge4| |badge5| +|badge1| |badge2| |badge3| |badge4| |badge5| This module allows to show a message popup on the client side as result of a button. @@ -113,6 +113,10 @@ Contributors * Benjamin Willig (ACSONE SA/NV) * Ioan Galan (Studio73) * Abraham Anes (Studio73) +* `DynApps NV `_: + + * Koen Loodts + * Raf Ven Maintainers ~~~~~~~~~~~ @@ -127,6 +131,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/web `_ project on GitHub. +This module is part of the `OCA/web `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_ir_actions_act_window_message/__init__.py b/web_ir_actions_act_window_message/__init__.py index e69de29bb..0650744f6 100644 --- a/web_ir_actions_act_window_message/__init__.py +++ b/web_ir_actions_act_window_message/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/web_ir_actions_act_window_message/__manifest__.py b/web_ir_actions_act_window_message/__manifest__.py index 3742c30ec..698b92965 100644 --- a/web_ir_actions_act_window_message/__manifest__.py +++ b/web_ir_actions_act_window_message/__manifest__.py @@ -2,12 +2,13 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "Client side message boxes", - "version": "13.0.1.0.0", + "version": "14.0.1.0.0", "author": "Therp BV, " "ACSONE SA/NV, " "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/web", "license": "AGPL-3", "category": "Hidden/Dependency", "summary": "Show a message box to users", "depends": ["web"], - "data": ["views/templates.xml"], + "data": ["security/ir.model.access.csv", "views/templates.xml"], "qweb": ["static/src/xml/web_ir_actions_act_window_message.xml"], } diff --git a/web_ir_actions_act_window_message/models/__init__.py b/web_ir_actions_act_window_message/models/__init__.py new file mode 100644 index 000000000..16285e5e1 --- /dev/null +++ b/web_ir_actions_act_window_message/models/__init__.py @@ -0,0 +1 @@ +from . import ir_actions diff --git a/web_ir_actions_act_window_message/models/ir_actions.py b/web_ir_actions_act_window_message/models/ir_actions.py new file mode 100644 index 000000000..3c6bbd9c9 --- /dev/null +++ b/web_ir_actions_act_window_message/models/ir_actions.py @@ -0,0 +1,21 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import fields, models + + +class IrActionsActWindowMessage(models.Model): + _name = "ir.actions.act_window.message" + _description = "Action Window Message" + _inherit = "ir.actions.actions" + _table = "ir_actions" + + type = fields.Char(default="ir.actions.act_window.message") + + def _get_readable_fields(self): + return super()._get_readable_fields() | { + "title", + "buttons", + "close_button_title", + "message", + "is_html_message", + } diff --git a/web_ir_actions_act_window_message/readme/CONTRIBUTORS.rst b/web_ir_actions_act_window_message/readme/CONTRIBUTORS.rst index 7b22f2ca0..5b061c7c1 100644 --- a/web_ir_actions_act_window_message/readme/CONTRIBUTORS.rst +++ b/web_ir_actions_act_window_message/readme/CONTRIBUTORS.rst @@ -3,3 +3,7 @@ * Benjamin Willig (ACSONE SA/NV) * Ioan Galan (Studio73) * Abraham Anes (Studio73) +* `DynApps NV `_: + + * Koen Loodts + * Raf Ven diff --git a/web_ir_actions_act_window_message/security/ir.model.access.csv b/web_ir_actions_act_window_message/security/ir.model.access.csv new file mode 100644 index 000000000..4cddddda3 --- /dev/null +++ b/web_ir_actions_act_window_message/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +crud_ir_actions_act_window_message,access_ir_actions_act_window_message,model_ir_actions_act_window_message,,1,1,1,1 diff --git a/web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js b/web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js index 840dd4480..7b491aca0 100644 --- a/web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js +++ b/web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js @@ -1,7 +1,7 @@ /* Copyright 2017 Therp BV, ACSONE SA/NV * * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ -odoo.define("web.web_ir_actions_act_window_message", function(require) { +odoo.define("web.web_ir_actions_act_window_message", function (require) { "use strict"; var ActionManager = require("web.ActionManager"), @@ -11,20 +11,20 @@ odoo.define("web.web_ir_actions_act_window_message", function(require) { var _t = core._t; ActionManager.include({ - _handleAction: function(action, options) { + _handleAction: function (action, options) { if (action.type === "ir.actions.act_window.message") { return this._executeWindowMessageAction(action, options); } return this._super.apply(this, arguments); }, - _executeWindowMessageAction: function(action, options) { + _executeWindowMessageAction: function (action, options) { var self = this, buttons = []; if (action.close_button_title !== false) { buttons.push({ text: action.close_button_title || _t("Close"), - click: function() { + click: function () { // Refresh the view before closing the dialog var controller = self.getCurrentController(); if (controller && controller.widget) { @@ -61,7 +61,7 @@ odoo.define("web.web_ir_actions_act_window_message", function(require) { buttons: buttons.concat( this.ir_actions_act_window_message_get_buttons( action, - function() { + function () { dialog.close(); } ) @@ -72,21 +72,21 @@ odoo.define("web.web_ir_actions_act_window_message", function(require) { ); return dialog.open()._opened; }, - ir_actions_act_window_message_get_buttons: function(action, close_func) { + ir_actions_act_window_message_get_buttons: function (action, close_func) { // Return an array of button definitions from action var self = this; - return _.map(action.buttons || [], function(button_definition) { + return _.map(action.buttons || [], function (button_definition) { return { text: button_definition.name || "No name set", classes: button_definition.classes || "btn-default", - click: function() { - if (button_definition.type == "method") { + click: function () { + if (button_definition.type === "method") { self._rpc({ model: button_definition.model, method: button_definition.method, args: button_definition.args, kwargs: button_definition.kwargs, - }).then(function(result) { + }).then(function (result) { if (_.isObject(result)) { self.do_action(result); }