[IMP] web, *: move assets_common files directly inside assets_frontend
*: auth_password_policy, bus, calendar, event, mass_mailing, stock, survey, web_editor, web_tour, website, website_event, website_forum, website_mass_mailing, website_sale This commit is a first step towards a potential deletion of the assets_common bundle, although that step would need more work, specs and discussions as some layouts kinda only use the assets_common bundle (some take the full assets_common but parts of the assets_backend one for example). The main goal of this commit is to have the assets_frontend bundle directly include the "common" files we need. As a first step, this commit only blindly duplicates them all into assets_frontend (without removing the potentially useless ones). The goal is to have those advantages: - Reaching a frontend page only calls two main JS files (one normal and one lazy-loaded) instead of 4 (two normals and two lazy-loaded). This may help reach a better google page speed (which is becoming more and more strict). - The frontend CSS is built as one: the common SCSS which was using bootstrap variables, or even Odoo-based SCSS added by mistake in common instead of both backend and frontend is now computed with the right bootstrap customizations. E.g. the tempusdominus datetimepickers use bootstrap grays... after this PR, they use the right grays as customized by the user on the website. It was also chosen to not have a common "sub-asset" which is included in assets_frontend. Making assets_frontend completely independent makes sense (as it probably will for other "main" asset bundles): we can focus on adding the files each layout needs without the need of worrying if it impacts unrelated layouts. Sub-assets (when not strictly necessary) is also a source of errors: extending the "main" bundle instead of the right sub-asset it may use (like it was the case with the sub-assets of assets_common: _assets_common_scripts and _assets_common_styles as explained in the previous commit). So this is indeed a small drawback of not factorizing the code for the inclusion of "common" files in bundles but it seems more explicit and easier to maintain that way. Note that adding "common" file is not the most common usecase anyway, apps generally only need files in backend or frontend. The __manifest__ declaration will also likely evolve in more and more uses of wildcards to match entire directories. In the future, adding "common" web-app files in both backend, frontend and other "main" bundles could just be about one line duplicated into each bundle. closes odoo/odoo#100314 Related: odoo/enterprise#31394 Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit is contained in:
@@ -13,6 +13,10 @@
|
||||
'auth_password_policy/static/src/password_meter.js',
|
||||
'auth_password_policy/static/src/password_field.js',
|
||||
],
|
||||
'web.assets_frontend': [
|
||||
'auth_password_policy/static/src/css/password_field.css',
|
||||
'auth_password_policy/static/src/password_policy.js',
|
||||
],
|
||||
'web.assets_common': [
|
||||
'auth_password_policy/static/src/css/password_field.css',
|
||||
'auth_password_policy/static/src/password_policy.js',
|
||||
|
||||
@@ -16,6 +16,12 @@
|
||||
'bus/static/src/workers/websocket_worker.js',
|
||||
'bus/static/src/workers/websocket_worker_utils.js',
|
||||
],
|
||||
'web.assets_frontend': [
|
||||
'bus/static/src/*.js',
|
||||
'bus/static/src/services/**/*.js',
|
||||
'bus/static/src/workers/websocket_worker.js',
|
||||
'bus/static/src/workers/websocket_worker_utils.js',
|
||||
],
|
||||
'web.qunit_suite_tests': [
|
||||
'bus/static/tests/**/*.js',
|
||||
],
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
<template id="invitation_page_anonymous" name="Calendar Invitation Page for anonymous users">
|
||||
<t t-call="web.layout">
|
||||
<t t-set="head">
|
||||
<t t-call-assets="web.assets_common" t-js="false"/>
|
||||
<t t-call-assets="web.assets_frontend" t-js="false"/>
|
||||
</t>
|
||||
|
||||
|
||||
@@ -55,6 +55,9 @@ Key Features
|
||||
'web.assets_common': [
|
||||
'event/static/src/js/tours/**/*',
|
||||
],
|
||||
'web.assets_frontend': [
|
||||
'event/static/src/js/tours/**/*',
|
||||
],
|
||||
'web.report_assets_common': [
|
||||
'/event/static/src/scss/event_foldable_badge_report.scss',
|
||||
'/event/static/src/scss/event_full_page_ticket_report.scss',
|
||||
|
||||
@@ -116,6 +116,9 @@
|
||||
'web.assets_common': [
|
||||
'mass_mailing/static/src/js/tours/**/*',
|
||||
],
|
||||
'web.assets_frontend': [
|
||||
'mass_mailing/static/src/js/tours/**/*',
|
||||
],
|
||||
'web.qunit_suite_tests': [
|
||||
'mass_mailing/static/tests/mass_mailing_favourite_filter_tests.js',
|
||||
'mass_mailing/static/src/js/mass_mailing_snippets.js',
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
<!-- To view the body_arch field in readonly and have it display exactly
|
||||
like in edit, load all the same css. TODO: move all this and the above
|
||||
to a separate asset -->
|
||||
<t t-call-assets="web.assets_common" t-js="false"/>
|
||||
<t t-call-assets="web.assets_frontend" t-js="false"/>
|
||||
<t t-call-assets="web_editor.assets_wysiwyg" t-js="false"/>
|
||||
</template>
|
||||
|
||||
@@ -114,6 +114,9 @@
|
||||
'stock/static/src/scss/stock_empty_screen.scss',
|
||||
'stock/static/src/views/**/*',
|
||||
],
|
||||
'web.assets_frontend': [
|
||||
'stock/static/src/scss/stock_traceability_report.scss',
|
||||
],
|
||||
'web.assets_tests': [
|
||||
'stock/static/tests/tours/stock_report_tests.js',
|
||||
],
|
||||
|
||||
@@ -108,6 +108,9 @@ sent mails with personal token for the invitation of the survey.
|
||||
'web.assets_common': [
|
||||
'survey/static/src/js/tours/survey_tour.js',
|
||||
],
|
||||
'web.assets_frontend': [
|
||||
'survey/static/src/js/tours/survey_tour.js',
|
||||
],
|
||||
},
|
||||
'license': 'LGPL-3',
|
||||
}
|
||||
|
||||
+155
-26
@@ -35,16 +35,17 @@ This module provides the core of the Odoo Web Client.
|
||||
# 2) the prefix "assets_"
|
||||
# 3) an arbitrary name, relevant to the content of the bundle.
|
||||
#
|
||||
# Exemples:
|
||||
# > web.assets_common = assets common to both frontend and backend clients.
|
||||
# Examples:
|
||||
# > web.assets_common = assets common to backend clients and others
|
||||
# (not frontend).
|
||||
# > web_editor.assets_wysiwyg = assets needed by components defined in the "web_editor" module.
|
||||
'web.assets_common_minimal': [
|
||||
'web/static/src/legacy/js/promise_extension.js',
|
||||
'web/static/src/boot.js',
|
||||
'web/static/src/session.js',
|
||||
'web/static/src/legacy/js/core/cookie_utils.js',
|
||||
'web/static/src/legacy/js/core/menu.js',
|
||||
],
|
||||
|
||||
# Warning: Layouts using "assets_frontend" assets do not have the
|
||||
# "assets_common" assets anymore. So, if it make sense, files added in
|
||||
# "assets_common" should also be added in "assets_frontend".
|
||||
# TODO in the future, probably remove "assets_common" definition
|
||||
# entirely and let all "main" bundles evolve on their own, including the
|
||||
# files they need in their bundle.
|
||||
'web.assets_common': [
|
||||
('include', 'web._assets_helpers'),
|
||||
|
||||
@@ -77,7 +78,11 @@ This module provides the core of the Odoo Web Client.
|
||||
'web/static/src/legacy/scss/web.zoomodoo.scss',
|
||||
'web/static/src/legacy/scss/fontawesome_overridden.scss',
|
||||
|
||||
('include', 'web.assets_common_minimal'),
|
||||
'web/static/src/legacy/js/promise_extension.js',
|
||||
'web/static/src/boot.js',
|
||||
'web/static/src/session.js',
|
||||
'web/static/src/legacy/js/core/cookie_utils.js',
|
||||
'web/static/src/legacy/js/core/menu.js',
|
||||
|
||||
'web/static/lib/underscore/underscore.js',
|
||||
'web/static/lib/underscore.string/lib/underscore.string.js',
|
||||
@@ -170,15 +175,6 @@ This module provides the core of the Odoo Web Client.
|
||||
'web/static/src/legacy/js/widgets/translation_dialog.js',
|
||||
'web/static/src/legacy/xml/translation_dialog.xml',
|
||||
],
|
||||
'web.assets_common_lazy': [
|
||||
('include', 'web.assets_common'),
|
||||
# Remove assets_common_minimal
|
||||
('remove', 'web/static/src/legacy/js/promise_extension.js'),
|
||||
('remove', 'web/static/src/boot.js'),
|
||||
('remove', 'web/static/src/session.js'),
|
||||
('remove', 'web/static/src/legacy/js/core/cookie_utils.js'),
|
||||
('remove', 'web/static/src/legacy/js/core/menu.js'),
|
||||
],
|
||||
'web.assets_backend': [
|
||||
('include', 'web._assets_helpers'),
|
||||
('include', 'web._assets_backend_helpers'),
|
||||
@@ -310,9 +306,20 @@ This module provides the core of the Odoo Web Client.
|
||||
'web/static/lib/bootstrap/scss/_variables.scss',
|
||||
],
|
||||
'web.assets_frontend_minimal': [
|
||||
'web/static/src/legacy/js/promise_extension.js',
|
||||
'web/static/src/boot.js',
|
||||
'web/static/src/session.js',
|
||||
'web/static/src/legacy/js/core/cookie_utils.js',
|
||||
'web/static/src/legacy/js/core/menu.js',
|
||||
'web/static/src/legacy/js/public/lazyloader.js',
|
||||
],
|
||||
'web.assets_frontend': [
|
||||
# TODO the 'assets_frontend' bundle now includes 'assets_common'
|
||||
# files directly. That work was however a good opportunity to start
|
||||
# removing the files that are not needed anymore in frontend layouts
|
||||
# but it was not done: all common files were simply put in this
|
||||
# bundle. We'll have to optimize that.
|
||||
|
||||
('include', 'web._assets_helpers'),
|
||||
('include', 'web._assets_frontend_helpers'),
|
||||
|
||||
@@ -322,6 +329,128 @@ This module provides the core of the Odoo Web Client.
|
||||
|
||||
('include', 'web._assets_bootstrap'),
|
||||
|
||||
'web/static/src/legacy/scss/tempusdominus_overridden.scss',
|
||||
'web/static/lib/tempusdominus/tempusdominus.scss',
|
||||
'web/static/lib/jquery.ui/jquery-ui.css',
|
||||
'web/static/src/libs/fontawesome/css/font-awesome.css',
|
||||
'web/static/lib/odoo_ui_icons/*',
|
||||
'web/static/lib/select2/select2.css',
|
||||
'web/static/lib/select2-bootstrap-css/select2-bootstrap.css',
|
||||
'web/static/lib/daterangepicker/daterangepicker.css',
|
||||
'web/static/fonts/fonts.scss',
|
||||
'web/static/src/webclient/navbar/navbar.scss',
|
||||
'web/static/src/legacy/scss/ui.scss',
|
||||
'web/static/src/legacy/scss/ui_extra.scss',
|
||||
'web/static/src/legacy/scss/mimetypes.scss',
|
||||
'web/static/src/legacy/scss/modal.scss',
|
||||
'web/static/src/legacy/scss/animation.scss',
|
||||
'web/static/src/legacy/scss/datepicker.scss',
|
||||
'web/static/src/legacy/scss/daterangepicker.scss',
|
||||
'web/static/src/legacy/scss/banner.scss',
|
||||
'web/static/src/legacy/scss/colorpicker.scss',
|
||||
'web/static/src/legacy/scss/popover.scss',
|
||||
'web/static/src/legacy/scss/translation_dialog.scss',
|
||||
'web/static/src/legacy/scss/keyboard.scss',
|
||||
'web/static/src/legacy/scss/name_and_signature.scss',
|
||||
'web/static/src/legacy/scss/web.zoomodoo.scss',
|
||||
'web/static/src/legacy/scss/fontawesome_overridden.scss',
|
||||
|
||||
'web/static/src/legacy/scss/base_frontend.scss',
|
||||
'web/static/src/legacy/scss/lazyloader.scss',
|
||||
|
||||
('include', 'web.assets_frontend_minimal'),
|
||||
|
||||
'web/static/lib/underscore/underscore.js',
|
||||
'web/static/lib/underscore.string/lib/underscore.string.js',
|
||||
'web/static/lib/moment/moment.js',
|
||||
'web/static/lib/owl/owl.js',
|
||||
'web/static/src/owl2_compatibility/*.js',
|
||||
'web/static/src/legacy/js/component_extension.js',
|
||||
'web/static/src/legacy/legacy_component.js',
|
||||
'web/static/lib/jquery/jquery.js',
|
||||
'web/static/lib/jquery.ui/jquery-ui.js',
|
||||
'web/static/lib/jquery/jquery.browser.js',
|
||||
'web/static/lib/jquery.blockUI/jquery.blockUI.js',
|
||||
'web/static/lib/jquery.hotkeys/jquery.hotkeys.js',
|
||||
'web/static/lib/jquery.placeholder/jquery.placeholder.js',
|
||||
'web/static/lib/jquery.form/jquery.form.js',
|
||||
'web/static/lib/jquery.ba-bbq/jquery.ba-bbq.js',
|
||||
'web/static/lib/jquery.mjs.nestedSortable/jquery.mjs.nestedSortable.js',
|
||||
'web/static/lib/popper/popper.js',
|
||||
'web/static/lib/bootstrap/js/dist/dom/data.js',
|
||||
'web/static/lib/bootstrap/js/dist/dom/event-handler.js',
|
||||
'web/static/lib/bootstrap/js/dist/dom/manipulator.js',
|
||||
'web/static/lib/bootstrap/js/dist/dom/selector-engine.js',
|
||||
'web/static/lib/bootstrap/js/dist/base-component.js',
|
||||
'web/static/lib/bootstrap/js/dist/alert.js',
|
||||
'web/static/lib/bootstrap/js/dist/button.js',
|
||||
'web/static/lib/bootstrap/js/dist/carousel.js',
|
||||
'web/static/lib/bootstrap/js/dist/collapse.js',
|
||||
'web/static/lib/bootstrap/js/dist/dropdown.js',
|
||||
'web/static/lib/bootstrap/js/dist/modal.js',
|
||||
'web/static/lib/bootstrap/js/dist/offcanvas.js',
|
||||
'web/static/lib/bootstrap/js/dist/tooltip.js',
|
||||
'web/static/lib/bootstrap/js/dist/popover.js',
|
||||
'web/static/lib/bootstrap/js/dist/scrollspy.js',
|
||||
'web/static/lib/bootstrap/js/dist/tab.js',
|
||||
'web/static/lib/bootstrap/js/dist/toast.js',
|
||||
'web/static/lib/tempusdominus/tempusdominus.js',
|
||||
'web/static/lib/select2/select2.js',
|
||||
'web/static/lib/clipboard/clipboard.js',
|
||||
'web/static/lib/jSignature/jSignatureCustom.js',
|
||||
'web/static/lib/qweb/qweb2.js',
|
||||
'web/static/src/legacy/js/assets.js',
|
||||
'web/static/src/legacy/js/libs/autocomplete.js',
|
||||
'web/static/src/legacy/js/libs/bootstrap.js',
|
||||
'web/static/src/legacy/js/libs/content-disposition.js',
|
||||
'web/static/src/legacy/js/libs/download.js',
|
||||
'web/static/src/legacy/js/libs/fullcalendar.js',
|
||||
'web/static/src/legacy/js/libs/jquery.js',
|
||||
'web/static/src/legacy/js/libs/moment.js',
|
||||
'web/static/src/legacy/js/libs/underscore.js',
|
||||
'web/static/src/legacy/js/libs/pdfjs.js',
|
||||
'web/static/src/legacy/js/libs/zoomodoo.js',
|
||||
'web/static/src/legacy/js/libs/jSignatureCustom.js',
|
||||
'web/static/src/legacy/js/core/abstract_service.js',
|
||||
'web/static/src/legacy/js/core/abstract_storage_service.js',
|
||||
'web/static/src/legacy/js/core/ajax.js',
|
||||
'web/static/src/legacy/js/core/browser_detection.js',
|
||||
'web/static/src/legacy/js/core/bus.js',
|
||||
'web/static/src/legacy/js/core/class.js',
|
||||
'web/static/src/legacy/js/core/collections.js',
|
||||
'web/static/src/legacy/js/core/concurrency.js',
|
||||
'web/static/src/legacy/js/core/dialog.js',
|
||||
'web/static/src/legacy/xml/dialog.xml',
|
||||
'web/static/src/legacy/js/core/owl_dialog.js',
|
||||
'web/static/src/legacy/js/core/popover.js',
|
||||
'web/static/src/legacy/js/core/dom.js',
|
||||
'web/static/src/legacy/js/core/local_storage.js',
|
||||
'web/static/src/legacy/js/core/mixins.js',
|
||||
'web/static/src/legacy/js/core/qweb.js',
|
||||
'web/static/src/legacy/js/core/ram_storage.js',
|
||||
'web/static/src/legacy/js/core/registry.js',
|
||||
'web/static/src/legacy/js/core/rpc.js',
|
||||
'web/static/src/legacy/js/core/service_mixins.js',
|
||||
'web/static/src/legacy/js/core/session.js',
|
||||
'web/static/src/legacy/js/core/session_storage.js',
|
||||
'web/static/src/legacy/js/core/time.js',
|
||||
'web/static/src/legacy/js/core/translation.js',
|
||||
'web/static/src/legacy/js/core/utils.js',
|
||||
'web/static/src/legacy/js/core/widget.js',
|
||||
'web/static/src/legacy/js/services/ajax_service.js',
|
||||
'web/static/src/legacy/js/services/config.js',
|
||||
'web/static/src/legacy/js/services/core.js',
|
||||
'web/static/src/legacy/js/services/local_storage_service.js',
|
||||
'web/static/src/legacy/js/services/session_storage_service.js',
|
||||
'web/static/src/legacy/js/common_env.js',
|
||||
'web/static/src/legacy/js/widgets/name_and_signature.js',
|
||||
'web/static/src/legacy/xml/name_and_signature.xml',
|
||||
'web/static/src/legacy/js/core/smooth_scroll_on_drag.js',
|
||||
'web/static/src/legacy/js/widgets/colorpicker.js',
|
||||
'web/static/src/legacy/xml/colorpicker.xml',
|
||||
'web/static/src/legacy/js/widgets/translation_dialog.js',
|
||||
'web/static/src/legacy/xml/translation_dialog.xml',
|
||||
|
||||
'web/static/src/env.js',
|
||||
'web/static/src/core/utils/transitions.scss', # included early because used by other files
|
||||
'web/static/src/core/**/*',
|
||||
@@ -329,11 +458,6 @@ This module provides the core of the Odoo Web Client.
|
||||
('remove', 'web/static/src/core/debug/debug_menu.js'),
|
||||
'web/static/src/public/error_notifications.js',
|
||||
|
||||
'web/static/src/legacy/scss/base_frontend.scss',
|
||||
'web/static/src/legacy/scss/lazyloader.scss',
|
||||
|
||||
('include', 'web.assets_frontend_minimal'),
|
||||
|
||||
'web/static/src/legacy/utils.js',
|
||||
'web/static/src/legacy/js/core/misc.js',
|
||||
'web/static/src/legacy/js/owl_compatibility.js',
|
||||
@@ -351,7 +475,12 @@ This module provides the core of the Odoo Web Client.
|
||||
'web.assets_frontend_lazy': [
|
||||
('include', 'web.assets_frontend'),
|
||||
# Remove assets_frontend_minimal
|
||||
('remove', 'web/static/src/legacy/js/public/lazyloader.js')
|
||||
('remove', 'web/static/src/legacy/js/promise_extension.js'),
|
||||
('remove', 'web/static/src/boot.js'),
|
||||
('remove', 'web/static/src/session.js'),
|
||||
('remove', 'web/static/src/legacy/js/core/cookie_utils.js'),
|
||||
('remove', 'web/static/src/legacy/js/core/menu.js'),
|
||||
('remove', 'web/static/src/legacy/js/public/lazyloader.js'),
|
||||
],
|
||||
'web.assets_backend_prod_only': [
|
||||
'web/static/src/main.js',
|
||||
@@ -406,7 +535,7 @@ This module provides the core of the Odoo Web Client.
|
||||
# with the addition of a prefixed underscore to reflect the "private"
|
||||
# aspect.
|
||||
#
|
||||
# Exemples:
|
||||
# Examples:
|
||||
# > web._assets_helpers = define assets needed in most main bundles
|
||||
|
||||
'web._assets_primary_variables': [
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
</xpath>
|
||||
<xpath expr="//head/link[last()]" position="after">
|
||||
<link rel="preload" href="/web/static/src/libs/fontawesome/fonts/fontawesome-webfont.woff2?v=4.7.0" as="font" crossorigin=""/>
|
||||
<t t-call-assets="web.assets_common" t-js="false"/>
|
||||
<t t-call-assets="web.assets_frontend" t-js="false"/>
|
||||
</xpath>
|
||||
<xpath expr="//head/script[@id='web.layout.odooscript']" position="after">
|
||||
@@ -44,10 +43,8 @@
|
||||
document.cookie = `tz=${userTZ}; path=/`;
|
||||
}
|
||||
</script>
|
||||
<t t-call-assets="web.assets_common_minimal" t-css="false" defer_load="True"/>
|
||||
<t t-call-assets="web.assets_frontend_minimal" t-css="false" defer_load="True"/>
|
||||
<t t-call="web.conditional_assets_tests"/>
|
||||
<t t-call-assets="web.assets_common_lazy" t-css="false" lazy_load="True"/>
|
||||
<t t-call-assets="web.assets_frontend_lazy" t-css="false" lazy_load="True"/>
|
||||
</xpath>
|
||||
<xpath expr="//t[@t-out='0']" position="replace">
|
||||
|
||||
@@ -120,6 +120,13 @@ Odoo Web Editor widget.
|
||||
'web.assets_frontend': [
|
||||
('include', 'web_editor.assets_media_dialog'),
|
||||
|
||||
'web_editor/static/src/js/editor/odoo-editor/src/base_style.scss',
|
||||
'web_editor/static/lib/vkbeautify/**/*',
|
||||
'web_editor/static/src/js/common/**/*',
|
||||
'web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js',
|
||||
'web_editor/static/src/js/wysiwyg/fonts.js',
|
||||
'web_editor/static/src/xml/ace.xml',
|
||||
|
||||
'web_editor/static/src/scss/web_editor.common.scss',
|
||||
'web_editor/static/src/scss/web_editor.frontend.scss',
|
||||
|
||||
|
||||
@@ -34,6 +34,15 @@ Odoo Web tours.
|
||||
'web_tour/static/src/debug/tour_dialog_component.xml',
|
||||
],
|
||||
'web.assets_frontend': [
|
||||
'web_tour/static/src/scss/**/*',
|
||||
'web_tour/static/src/js/running_tour_action_helper.js',
|
||||
'web_tour/static/src/js/tip.js',
|
||||
'web_tour/static/src/js/tour_manager.js',
|
||||
'web_tour/static/src/js/tour_service.js',
|
||||
'web_tour/static/src/js/tour_step_utils.js',
|
||||
'web_tour/static/src/js/tour_utils.js',
|
||||
'/web_tour/static/src/xml/tip.xml',
|
||||
|
||||
'web_tour/static/src/js/public/**/*',
|
||||
],
|
||||
'web.qunit_suite_tests': [
|
||||
|
||||
@@ -119,6 +119,7 @@
|
||||
'website/static/src/scss/website.scss',
|
||||
'website/static/src/scss/website.ui.scss',
|
||||
'website/static/src/js/utils.js',
|
||||
'website/static/src/js/tours/tour_utils.js',
|
||||
'website/static/src/js/content/website_root.js',
|
||||
'website/static/src/js/widgets/dialog.js',
|
||||
'website/static/src/js/content/compatibility.js',
|
||||
|
||||
@@ -738,7 +738,6 @@ class Website(Home):
|
||||
Reloads asset bundles and returns their unique URLs.
|
||||
"""
|
||||
return {
|
||||
'web.assets_common': request.env['ir.qweb']._get_asset_link_urls('web.assets_common', request.session.debug),
|
||||
'web.assets_frontend': request.env['ir.qweb']._get_asset_link_urls('web.assets_frontend', request.session.debug),
|
||||
}
|
||||
|
||||
|
||||
@@ -157,12 +157,9 @@ class IrQWeb(models.AbstractModel):
|
||||
def _pregenerate_assets_bundles(self):
|
||||
# website is adding a website_id to the extra part of the attachement url (/1)
|
||||
|
||||
# /web/assets/2223-ee56665/1/web.assets_common.min.css
|
||||
# /web/assets/2224-47bce88/1/web.assets_frontend.min.css
|
||||
# /web/assets/2225-8b64a2b/1/web.assets_common_minimal.min.js
|
||||
# /web/assets/2226-17d3428/1/web.assets_frontend_minimal.min.js
|
||||
# /web/assets/2227-b9cd4ba/1/web.assets_tests.min.js
|
||||
# /web/assets/2228-7424684/1/web.assets_common_lazy.min.js
|
||||
# /web/assets/2229-25b1d52/1/web.assets_frontend_lazy.min.js
|
||||
|
||||
# this means that the previously generated attachment wont be used on the website
|
||||
@@ -179,7 +176,7 @@ class IrQWeb(models.AbstractModel):
|
||||
bundle_info = node[1]
|
||||
bundle_url = bundle_info.get('src', '') or bundle_info.get('href', '')
|
||||
if bundle_url.startswith('/web/assets/'):
|
||||
# example: "/web/assets/2152-ee56665/web.assets_common.min.js"
|
||||
# example: "/web/assets/2152-ee56665/web.assets_frontend_lazy.min.js"
|
||||
_, _, _, id_unique, name = bundle_url.split('/')
|
||||
attachment_id, unique = id_unique.split('-')
|
||||
url_pattern = f'/web/assets/%s-%s/{website.id}/{name}'
|
||||
|
||||
@@ -146,7 +146,7 @@ class TestWebsitePerformancePost(UtilPerf):
|
||||
@mute_logger('odoo.http')
|
||||
def test_50_perf_sql_web_assets(self):
|
||||
# assets route /web/assets/..
|
||||
self.env['ir.qweb']._generate_asset_nodes('web.assets_common', css=False, js=True)
|
||||
assets_url = self.env['ir.attachment'].search([('url', '=like', '/web/assets/%/web.assets_common%.js')], limit=1).url
|
||||
self.env['ir.qweb']._generate_asset_nodes('web.assets_frontend_lazy', css=False, js=True)
|
||||
assets_url = self.env['ir.attachment'].search([('url', '=like', '/web/assets/%/web.assets_frontend_lazy%.js')], limit=1).url
|
||||
self.assertEqual(self._get_url_hot_query(assets_url), 4)
|
||||
self.assertEqual(self._get_url_hot_query(assets_url, cache=False), 4)
|
||||
|
||||
@@ -2528,7 +2528,6 @@ Sitemap: <t t-esc="url_root"/>sitemap.xml
|
||||
|
||||
<template id="iframefallback" inherit_id="web.layout" primary="True">
|
||||
<xpath expr="//head/link[last()]" position="after">
|
||||
<t t-call-assets="web.assets_common" t-js="false"/>
|
||||
<t t-call-assets="web.assets_frontend" t-js="false"/>
|
||||
<t t-call-assets="website.assets_wysiwyg" t-js="false"/>
|
||||
</xpath>
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
'website_event/static/tests/**/*',
|
||||
],
|
||||
'web.assets_frontend': [
|
||||
'website_event/static/src/js/tours/**/*',
|
||||
'website_event/static/src/scss/event_templates_common.scss',
|
||||
'website_event/static/src/scss/event_templates_list.scss',
|
||||
'website_event/static/src/scss/event_templates_page.scss',
|
||||
|
||||
@@ -52,6 +52,7 @@ Ask questions, get answers, no distractions
|
||||
'website_forum/static/src/js/tours/website_forum.js',
|
||||
],
|
||||
'web.assets_frontend': [
|
||||
'website_forum/static/src/js/tours/website_forum.js',
|
||||
'website_forum/static/src/scss/website_forum.scss',
|
||||
'website_forum/static/src/js/website_forum.js',
|
||||
'website_forum/static/src/js/website_forum.share.js',
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<template id="iframe_css_assets_edit" name="CSS assets for wysiwyg iframe content for popup" groups="base.group_user">
|
||||
<t t-call-assets="web.assets_common" t-js="false"/>
|
||||
<t t-call-assets="web.assets_frontend" t-js="false"/>
|
||||
<t t-call-assets="web_editor.assets_wysiwyg" t-js="false"/>
|
||||
<t t-call-assets="website.assets_editor" t-js="false"/>
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
'uninstall_hook': 'uninstall_hook',
|
||||
'assets': {
|
||||
'web.assets_frontend': [
|
||||
'website_sale/static/src/js/tours/tour_utils.js',
|
||||
'website_sale/static/src/scss/website_sale.scss',
|
||||
'website_sale/static/src/scss/website_mail.scss',
|
||||
'website_sale/static/src/scss/website_sale_frontend.scss',
|
||||
|
||||
Reference in New Issue
Block a user