Files
odoo_source/addons/website/static/src/xml/website.xml
T
Romain Derie 4206c1f225 [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>
2020-02-24 15:43:32 +00:00

102 lines
4.8 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="website.prompt">
<div role="dialog" class="modal o_technical_modal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<header class="modal-header" t-if="window_title">
<h3 class="modal-title"><t t-esc="window_title"/></h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>
</header>
<main class="modal-body">
<form role="form" t-att-id="id">
<div class="form-group row mb0">
<label for="page-name" class="col-md-3 col-form-label">
<t t-esc="field_name"/>:
</label>
<div class="col-md-9">
<input t-if="field_type == 'input'" type="text" class="form-control" required="required"/>
<textarea t-if="field_type == 'textarea'" class="form-control" required="required" rows="5"></textarea>
<select t-if="field_type == 'select'" class="form-control"></select>
</div>
</div>
</form>
</main>
<footer class="modal-footer">
<button type="button" class="btn btn-primary btn-continue">Continue</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal" aria-label="Cancel">Cancel</button>
</footer>
</div>
</div>
</div>
</t>
<t t-name="website.dependencies">
<p class="text-warning">Don't forget to update all links referring to this page.</p>
<t t-if="dependencies and _.keys(dependencies).length">
<p class="text-warning">We found these ones:</p>
<div t-foreach="dependencies" t-as="type" class="mb16">
<a class="collapsed fa fa-caret-right" data-toggle="collapse" t-attf-href="#collapseDependencies#{type_index}" aria-expanded="false" t-attf-aria-controls="collapseDependencies#{type_index}">
<t t-esc="type"/>&amp;nbsp;
<span class="text-muted"><t t-esc="type_value.length"/> found(s)</span>
</a>
<div t-attf-id="collapseDependencies#{type_index}" class="collapse" aria-expanded="false">
<ul>
<li t-foreach="type_value" t-as="error">
<a t-if="!_.contains(['', '#', false], error.link)" t-att-href="error.link">
<t t-raw="error.text"/>
</a>
<t t-else="">
<t t-raw="error.text"/>
</t>
</li>
</ul>
</div>
</div>
</t>
</t>
<div t-name="website.delete_page">
<p>Are you sure you want to delete this page ?</p>
<t t-call="website.dependencies"/>
</div>
<div t-name="website.rename_page">
<div class="card">
<div class="card-body">
<form>
<div class="form-group row mb0">
<label for="new_name" class="col-form-label col-md-4">Rename Page To:</label>
<div class="col-md-8">
<input type="text" class="form-control" id="new_name" placeholder="e.g. About Us"/>
</div>
</div>
</form>
</div>
</div>
<t t-call="website.dependencies"/>
</div>
<div t-name="website.duplicate_page_action_dialog">
<div class="form-group row">
<label class="col-form-label col-md-3" for="page_name">Page Name</label>
<div class="col-md-9">
<input type="text" class="form-control" id="page_name"/>
</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>