mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[MIG] web_ir_actions_act_window_message: Migration to 14.0
This commit is contained in:
committed by
Jasmin Solanki
parent
b9a1139de9
commit
ebb59c4471
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user