From 9788447a7a9cdea62bfea79b43b8a136f43e9d8d Mon Sep 17 00:00:00 2001 From: roen-odoo Date: Mon, 21 Mar 2022 10:22:25 +0000 Subject: [PATCH] [FIX] web: Avoid showing bootstrap error Current behavior: In some particular cases bootstrap was throwing an error "Uncaught Error: Please use show on visible elements" wich appeared on the users screens. Steps to reproduce: - Could only reproduce on copy of clients Db - Go in CRM and go in any lead - Create a new activity - Swap to an activity with less fields - Then quickly put your mouse on the top of a field that just disappeared - The "Please use show on visible elements" error appears. Here's a video where I reproduce it on clients Db : https://watch.screencastify.com/v/gksBwwF0McirZzSFwaAP opw-2720853 closes odoo/odoo#87770 X-original-commit: 3404c9500fad4004d6d8beef6041ac51439078cd Signed-off-by: Aaron Bohy (aab) Signed-off-by: Engels Robin (roen) --- addons/web/static/src/legacy/js/libs/bootstrap.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/legacy/js/libs/bootstrap.js b/addons/web/static/src/legacy/js/libs/bootstrap.js index 9854b47a925..3da9db81d49 100644 --- a/addons/web/static/src/legacy/js/libs/bootstrap.js +++ b/addons/web/static/src/legacy/js/libs/bootstrap.js @@ -78,8 +78,15 @@ $.fn.tooltip.Constructor.prototype.show = function () { // Overwrite bootstrap tooltip method to prevent showing 2 tooltip at the // same time $('.tooltip').remove(); - - return bootstrapShowFunction.call(this); + const errorsToIgnore = ["Please use show on visible elements"]; + try { + return bootstrapShowFunction.call(this); + } catch (error) { + if (errorsToIgnore.includes(error.message)) { + return 0; + } + throw error; + } }; /* Bootstrap scrollspy fix for non-body to spy */