diff --git a/addons/web/views/webclient_templates.xml b/addons/web/views/webclient_templates.xml index bf242b4a28e..e74a5c8f650 100644 --- a/addons/web/views/webclient_templates.xml +++ b/addons/web/views/webclient_templates.xml @@ -290,6 +290,13 @@ odoo.reloadMenus = () => fetch(`/web/webclient/load_menus/${odoo.session_info.cache_hashes.load_menus}`).then(res => res.json()); odoo.loadMenusPromise = odoo.reloadMenus(); odoo.loadTemplatesPromise = fetch(`/web/webclient/qweb/${odoo.session_info.cache_hashes.qweb}?bundle=web.assets_qweb`).then(doc => doc.text()); + // Block to avoid leaking variables in the script scope + { + const { user_context, cache_hashes } = odoo.session_info; + // Prefetch translations to speedup webclient. This is done in JS because link rel="prefetch" + // is not yet supported on safari. + fetch(`/web/webclient/translations/${cache_hashes.translations}?lang=${user_context.lang}`); + }