mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[MIG] web_ir_actions_act_multi: Migration to 15.0
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import {registry} from "@web/core/registry";
|
||||
|
||||
/**
|
||||
* Handle 'ir.actions.act_multi' action
|
||||
* @param {object} action see _handleAction() parameters
|
||||
* @returns {$.Promise}
|
||||
*/
|
||||
|
||||
async function executeMultiAction({env, action}) {
|
||||
return action.actions
|
||||
.map((item) => {
|
||||
return () => {
|
||||
return env.services.action.doAction(item);
|
||||
};
|
||||
})
|
||||
.reduce((prev, cur) => {
|
||||
return prev.then(cur);
|
||||
}, Promise.resolve());
|
||||
}
|
||||
|
||||
registry.category("action_handlers").add("ir.actions.act_multi", executeMultiAction);
|
||||
@@ -1,43 +0,0 @@
|
||||
// Copyright 2017 - 2018 Modoolar <info@modoolar.com>
|
||||
// Copyright 2018 Brainbean Apps <hello@brainbeanapps.com>
|
||||
// Copyright 2020 Manuel Calero - Tecnativa
|
||||
// License LGPLv3.0 or later (https://www.gnu.org/licenses/lgpl-3.0.en.html).
|
||||
|
||||
odoo.define("web_ir_actions_act_multi.ir_actions_act_multi", function(require) {
|
||||
"use strict";
|
||||
|
||||
var ActionManager = require("web.ActionManager");
|
||||
|
||||
ActionManager.include({
|
||||
/**
|
||||
* Intercept action handling to detect extra action type
|
||||
* @override
|
||||
*/
|
||||
_handleAction: function(action, options) {
|
||||
if (action.type === "ir.actions.act_multi") {
|
||||
return this._executeMultiAction(action, options);
|
||||
}
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle 'ir.actions.act_multi' action
|
||||
* @param {Object} action see _handleAction() parameters
|
||||
* @param {Object} options see _handleAction() parameters
|
||||
* @returns {$.Promise}
|
||||
*/
|
||||
_executeMultiAction: function(action, options) {
|
||||
const self = this;
|
||||
|
||||
return action.actions
|
||||
.map(item => {
|
||||
return () => {
|
||||
return self._handleAction(item, options);
|
||||
};
|
||||
})
|
||||
.reduce((prev, cur) => {
|
||||
return prev.then(cur);
|
||||
}, Promise.resolve());
|
||||
},
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user