From 56e6c90e6d79d3e39dbc47636ec568b0a7a8dbbc Mon Sep 17 00:00:00 2001 From: "Nasreddin Boulif (bon)" Date: Thu, 3 Feb 2022 16:34:00 +0000 Subject: [PATCH] [FIX] web: display correct favicon depending company MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps to reproduce: - Activate Debug mode - Go to Settings -> Companies - Create company A and B and set a different favicon for each company - Refresh the page or switch company Issue: The favicon is not the right one. Cause: Code (that update favicon) removed when refractoring of owl. Related commit: https://github.com/odoo/odoo/commit/0573acae2306bf5da2005852da9323ddc59e5431 Solution: When web client start, update in JS the favicons (desktop and mobiles) with current company favicon. opw-2664525 closes odoo/odoo#84571 X-original-commit: fa2cc58ef34382a8b9a8d04a6e54267e39630432 Signed-off-by: Jérémy Kersten Signed-off-by: Nasreddin Boulif (bon) --- addons/web/static/src/start.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/addons/web/static/src/start.js b/addons/web/static/src/start.js index 60ac93f30d3..bf0bb0ead39 100644 --- a/addons/web/static/src/start.js +++ b/addons/web/static/src/start.js @@ -58,4 +58,15 @@ export async function startWebClient(Webclient) { // delete odoo.debug; // FIXME: some legacy code rely on this odoo.__WOWL_DEBUG__ = { root }; odoo.isReady = true; + + // Update Favicons + const favicon = `/web/image/res.company/${env.services.company.currentCompany.id}/favicon`; + const icons = document.querySelectorAll("link[rel*='icon']"); + const msIcon = document.querySelector("meta[name='msapplication-TileImage']"); + for (const icon of icons) { + icon.href = favicon; + } + if (msIcon) { + msIcon.content = favicon; + } }