From 449d76dbcabc69a6f9506c7575a3f4dde16664b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Thu, 1 Sep 2022 09:30:38 +0000 Subject: [PATCH] [FIX] im_livechat: do not willStart when livechat unavailable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up of https://github.com/odoo/odoo/pull/98160 PR above made single app im_livechat tests sometimes fail with following error: ``` TypeError: LivechatController.livechat_init() missing 1 required positional argument: 'channel_id' ``` This comes from RPC `/im_livechat/init` in frontend, which must provide `channel_id` but somehow doesn't sometimes. This only happens with `test_im_livechat_support_page`, sometimes on runbot. Task-2969488 closes odoo/odoo#99385 Signed-off-by: Sébastien Theys (seb) --- .../im_livechat/static/src/models/public_livechat_global.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/im_livechat/static/src/models/public_livechat_global.js b/addons/im_livechat/static/src/models/public_livechat_global.js index 79d2f2b406f..2bd4a6a1185 100644 --- a/addons/im_livechat/static/src/models/public_livechat_global.js +++ b/addons/im_livechat/static/src/models/public_livechat_global.js @@ -26,7 +26,9 @@ registerModel({ } set_cookie(this.LIVECHAT_COOKIE_HISTORY, JSON.stringify(urlHistory), 60 * 60 * 24); // 1 day cookie } - this.willStart(); + if (this.isAvailable) { + this.willStart(); + } }, }, recordMethods: {