[FIX] web: display correct favicon depending company

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 <jke@odoo.com>
Signed-off-by: Nasreddin Boulif (bon) <bon@odoo.com>
This commit is contained in:
Nasreddin Boulif (bon)
2022-02-15 08:34:05 +00:00
parent ecd08f519f
commit 56e6c90e6d
+11
View File
@@ -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;
}
}