From 2cef72a97098e81e32696506f999e10045e56c75 Mon Sep 17 00:00:00 2001 From: Nicolas Bayet Date: Mon, 28 Mar 2022 14:05:41 +0000 Subject: [PATCH] [FIX] web_editor: properly select the command of powerbox Before this commit On mobile, clicking on a powerbox item called the first command. After this commit On mobile, clicking on a powerbox item call the clicked item command. task-2751059 closes odoo/odoo#88059 X-original-commit: 03638e4d46941bb4751ac2d6df8c08cb4cc2208e Signed-off-by: Antoine Guenet Signed-off-by: David Monjoie (dmo) --- .../static/lib/odoo-editor/src/powerbox/Powerbox.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/addons/web_editor/static/lib/odoo-editor/src/powerbox/Powerbox.js b/addons/web_editor/static/lib/odoo-editor/src/powerbox/Powerbox.js index a8523dc73e1..2df4c28e1ae 100644 --- a/addons/web_editor/static/lib/odoo-editor/src/powerbox/Powerbox.js +++ b/addons/web_editor/static/lib/odoo-editor/src/powerbox/Powerbox.js @@ -131,7 +131,7 @@ export class Powerbox { ev => { ev.preventDefault(); ev.stopImmediatePropagation(); - this._currentValidate(); + this._currentValidate(command); }, true, ); @@ -254,10 +254,12 @@ export class Powerbox { this.options.onStop && this.options.onStop(); }; - this._currentValidate = async () => { - const command = this._currentFilteredCommands.find( - c => c === this._currentSelectedCommand, - ); + this._currentValidate = async (command) => { + if (!command) { + command = this._currentFilteredCommands.find( + c => c === this._currentSelectedCommand, + ); + } if (command) { !command.isIntermediateStep && (!command.shouldPreValidate || command.shouldPreValidate()) &&