[FIX] web_ir_actions_act_multi: preprocess chained actions

The proper way to execute an action is to pass it trhough `doAction` instead of `_handleAction`, because `doAction` performs some preparations to make the action usable.

One example is if some of your chained actions returns `context` as a string. That is valid for Odoo, but since we are skipping the action preparation step, it does not get evaluated and thus fails.

@Tecnativa TT28202
pull/1881/head
Jairo Llopis 2021-03-25 11:13:30 +00:00
parent 7f909358ad
commit 39a31732ee
No known key found for this signature in database
GPG Key ID: 8B8A6900E4831A9B
1 changed files with 4 additions and 4 deletions

View File

@ -23,8 +23,8 @@ odoo.define('web_ir_actions_act_multi.ir_actions_act_multi', function (require)
/** /**
* Handle 'ir.actions.act_multi' action * Handle 'ir.actions.act_multi' action
* @param {Object} action see _handleAction() parameters * @param {Object} action see doAction() parameters
* @param {Object} options see _handleAction() parameters * @param {Object} options see doAction() parameters
* @param {integer|undefined} index Index of action being handled * @param {integer|undefined} index Index of action being handled
* @returns {$.Promise} * @returns {$.Promise}
*/ */
@ -36,13 +36,13 @@ odoo.define('web_ir_actions_act_multi.ir_actions_act_multi', function (require)
} }
if (index === action.actions.length - 1) { if (index === action.actions.length - 1) {
return this._handleAction(action.actions[index], options); return this.doAction(action.actions[index], options);
} else if (index >= action.actions.length) { } else if (index >= action.actions.length) {
return $.when(); return $.when();
} }
return this return this
._handleAction(action.actions[index], options) .doAction(action.actions[index], options)
.then(function () { .then(function () {
return self._executeMultiAction(action, options, index + 1); return self._executeMultiAction(action, options, index + 1);
}); });