mirror of https://github.com/OCA/web.git
[MIG] web_ir_actions_act_window_message: Migration to 14.0
parent
8e8b13e448
commit
86f903839e
|
@ -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) <benjamin.willig@acsone.eu>
|
||||
* Ioan Galan (Studio73) <ioan@studio73.es>
|
||||
* Abraham Anes (Studio73) <abraham@studio73.es>
|
||||
* `DynApps NV <https://www.dynapps.be>`_:
|
||||
|
||||
* 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 <https://github.com/OCA/web/tree/13.0/web_ir_actions_act_window_message>`_ project on GitHub.
|
||||
This module is part of the `OCA/web <https://github.com/OCA/web/tree/14.0/web_ir_actions_act_window_message>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
from . import models
|
|
@ -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"],
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
from . import ir_actions
|
|
@ -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",
|
||||
}
|
|
@ -3,3 +3,7 @@
|
|||
* Benjamin Willig (ACSONE SA/NV) <benjamin.willig@acsone.eu>
|
||||
* Ioan Galan (Studio73) <ioan@studio73.es>
|
||||
* Abraham Anes (Studio73) <abraham@studio73.es>
|
||||
* `DynApps NV <https://www.dynapps.be>`_:
|
||||
|
||||
* Koen Loodts
|
||||
* Raf Ven
|
||||
|
|
|
@ -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
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue