summaryrefslogtreecommitdiff
path: root/addons/website/static/src/xml
diff options
context:
space:
mode:
authorRomain Derie <rde@odoo.com>2020-02-20 15:12:01 +0000
committerRomain Derie <rde@odoo.com>2020-02-24 15:43:32 +0000
commit4206c1f225f5b1c54a0cdd4913e1d8224a2e7889 (patch)
tree6b48184e73f4cfeb74fc0295c76b6150b03c246e /addons/website/static/src/xml
parent6898fec5a633a7a89759eb78d528dfceb0f6a8a0 (diff)
[FIX] website: don't load ir.ui.menu in frontend until needed
Before this commit: When logged in and navigating on a frontend page, the accessible `ir.ui.menu` would be loaded in qcontext. Loading those menus performs alot of SQL request, up to ~2.000 requests on big databases such as Odoo.com for an user with a lot of access rights. This is not a problem on low traffic website as this is ORM cached, but when there is a lot of traffic, the cache is clear very often, thus this code only is adding a lot of requests for no reason most of the time as the user is just navigating without any intention of opening the application menu. Note that this qcontext computation in frontend was pointless in enterprise as the applications menu in frontend redirect to the backend without using it. This commit removes that computation from the qcontext. The menus will be computed and loaded only when the user really needs it, when he is about to open the application menu. closes odoo/odoo#46127 X-original-commit: 471ddf85ce619961e46fb281bf721968ff298d3b Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
Diffstat (limited to 'addons/website/static/src/xml')
-rw-r--r--addons/website/static/src/xml/website.xml13
1 files changed, 13 insertions, 0 deletions
diff --git a/addons/website/static/src/xml/website.xml b/addons/website/static/src/xml/website.xml
index a8af566ecfb..8d196b9bba4 100644
--- a/addons/website/static/src/xml/website.xml
+++ b/addons/website/static/src/xml/website.xml
@@ -85,4 +85,17 @@
</div>
</div>
</div>
+
+ <t t-name="website.oe_applications_menu">
+ <t t-as="menu" t-foreach="menu_data.children">
+ <a role="menuitem" class="dropdown-item"
+ t-att-data-action-id="menu.action ? menu.action.split(',')[1] : undefined"
+ t-att-data-action-model="menu.action ? menu.action.split(',')[0] : undefined"
+ t-att-data-menu="menu.id"
+ t-att-data-menu-xmlid="menu.xmlid"
+ t-att-href="_.str.sprintf('/web#menu_id=%s&amp;action=%s', menu.id, menu.action ? menu.action.split(',')[1] : '')">
+ <span class="oe_menu_text" t-esc="menu.name"/>
+ </a>
+ </t>
+ </t>
</templates>