30 lines
1.5 KiB
XML
30 lines
1.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
<data>
|
|
|
|
<template id="webclient_bootstrap" inherit_id="web.webclient_bootstrap">
|
|
<xpath expr="//script" position="replace">
|
|
<script type="text/javascript">
|
|
// Block to avoid leaking variables in the script scope
|
|
{
|
|
odoo.__session_info__ = <t t-out="json.dumps(session_info)"/>;
|
|
const { user_context, cache_hashes } = odoo.__session_info__;
|
|
const lang = new URLSearchParams(document.location.search).get("lang");
|
|
let load_menus= new Date().getTime().toString();
|
|
let menuURL = `/web/webclient/load_menus/${load_menus}`;
|
|
if (lang) {
|
|
user_context.lang = lang;
|
|
menuURL += `?lang=${lang}`
|
|
}
|
|
odoo.reloadMenus = () => fetch(menuURL).then(res => res.json());
|
|
odoo.loadMenusPromise = odoo.reloadMenus();
|
|
// 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}`);
|
|
}
|
|
</script>
|
|
</xpath>
|
|
</template>
|
|
|
|
</data>
|
|
</odoo> |