[FIX] website: review t-cache of the <head> in website.layout
The `t-cache` used on the `<head>` of website.layout was wrong: it depended on the use of debug=assets or not (added by [1]) while it should at least also depend on debug=tests. This commit chooses to fix the issue by not using the caching system in case any value of debug is used. This commit also comments this `t-cache` value. Steps to reproduce: - As a visitor, first visit the homepage without debug mode - Now reach the homepage with ?debug=tests => You still don't have the tests assets Worse (but unlikely in production of course): - Create a fresh DB and first reach the homepage with debug=tests => Now all your visitors are damned to load the tests tours for no reason (and you likely have lots of errors shown in your console). [1]: https://github.com/odoo/odoo/commit/3061a484168ff21e3ae7e40ce691d299b63484a4 opw-3203912 closes odoo/odoo#114875 X-original-commit: 5efb637d880f82ea81bb64a0d091ffa7bdf7635b Signed-off-by: Romain Derie (rde) <rde@odoo.com> Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
@@ -55,7 +55,20 @@
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//head" position="attributes">
|
||||
<attribute name="t-cache">('assets' in request.session.debug, main_object) if main_object and main_object._name == 'website.page' and not (editable or translatable) else None</attribute>
|
||||
<!--
|
||||
Cache the <head> of the website.layout:
|
||||
- For each individual website.page record (their css/js might be the
|
||||
same but their title will not for example). Arguably we could do this
|
||||
for any record (not only website.page) but this t-cache was originally
|
||||
added to replace the website.page own cache system. For other records,
|
||||
it could probably depend on each individual access right.
|
||||
- Only for non-designers (especially visitors) (hence the "editable or
|
||||
translatable" check).
|
||||
- Only if not in any debug mode (we want any correct value of debug mode
|
||||
to correctly appear in the `odoo` object + assets may depend on this
|
||||
(e.g. debug=assets or debug=tests)).
|
||||
-->
|
||||
<attribute name="t-cache">main_object if main_object and main_object._name == 'website.page' and not request.session.debug and not editable and not translatable else None</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//head/*[1]" position="before">
|
||||
<t t-if="not title">
|
||||
|
||||
Reference in New Issue
Block a user