From 6f95be6884a59665ca7d8a809e7aaa17695fa9b0 Mon Sep 17 00:00:00 2001 From: Samuel Degueldre Date: Thu, 17 Aug 2023 11:44:12 +0000 Subject: [PATCH] [REF] *: remove web.assets_common *: auth_password_policy, bus, event, im_livechat, mail, mass_mailing, mrp_subcontracting, point_of_sale, pos_self_order, project, stock, survey, web, web_editor, web_tour, website, website_event, website_forum, website_sale, website_slides, base Historically, the web.assets_common bundle was used to contain assets that were needed by both the frontend and the backend. In practice, this caused a bunch of issues where people would add things in assets common that were not needed by both, and it was also abused as a way to get bootstrap working in unrelated places by only using that bundle's css. Because of this, as a first step, the assets_common stop being used in the frontend, but was left everywhere else. This commit removes the bundle completely, and moves the files that used to be in that bundle in the other bundles that need them, this will allow those bundles to evolve independently going forward. in im_livechat and mail, some of the unneeded legacy code was removed, this allows us to avoind including all of the legacy code from web in the livechat embed bundle and in the dicuss public bundle respectively. closes odoo/odoo#132190 Related: odoo/enterprise#45884 Signed-off-by: Aaron Bohy (aab) --- addons/auth_password_policy/__manifest__.py | 8 +- addons/bus/__manifest__.py | 2 +- .../static/src/services/presence_service.js | 6 -- addons/bus/tests/test_assetsbundle.py | 12 +-- addons/event/__manifest__.py | 2 - addons/im_livechat/__manifest__.py | 22 +++-- .../src/embed/external/session_legacy.js | 6 -- .../im_livechat/views/webclient_templates.xml | 2 - addons/mail/__manifest__.py | 28 +++--- .../static/src/core/common/attachment_view.js | 2 +- .../static/src/discuss/core/public/boot.js | 7 +- .../src/discuss/core/public/root_widget.js | 14 --- addons/mass_mailing/__manifest__.py | 4 +- addons/mrp_subcontracting/__manifest__.py | 92 +++++++++++++++++- .../views/subcontracting_portal_templates.xml | 5 +- addons/point_of_sale/__manifest__.py | 10 +- addons/pos_self_order/__manifest__.py | 10 +- addons/project/__manifest__.py | 94 +++++++++++++++++- ...project_sharing_project_task_templates.xml | 5 +- addons/stock/__manifest__.py | 3 - addons/survey/__manifest__.py | 4 +- addons/web/__manifest__.py | 73 ++++++-------- addons/web/static/src/legacy/js/libs/pdfjs.js | 66 ------------- addons/web/static/src/legacy/scss/ui.scss | 7 +- addons/web/static/src/libs/pdfjs.js | 67 +++++++++++++ .../static/src/scss/bs_mixins_overrides.scss | 2 +- .../static/src/views/fields/file_handler.xml | 2 +- addons/web/views/webclient_templates.xml | 18 +--- addons/web_editor/__manifest__.py | 97 ++++++++++++++++++- addons/web_tour/__manifest__.py | 8 +- addons/website/__manifest__.py | 4 +- addons/website_event/__manifest__.py | 2 +- addons/website_forum/__manifest__.py | 2 +- addons/website_sale/__manifest__.py | 4 +- addons/website_slides/__manifest__.py | 2 +- .../website_slides_templates_lesson_embed.xml | 1 - odoo/addons/base/models/assetsbundle.py | 2 +- 37 files changed, 426 insertions(+), 269 deletions(-) delete mode 100644 addons/im_livechat/static/src/embed/external/session_legacy.js delete mode 100644 addons/mail/static/src/discuss/core/public/root_widget.js delete mode 100644 addons/web/static/src/legacy/js/libs/pdfjs.js create mode 100644 addons/web/static/src/libs/pdfjs.js diff --git a/addons/auth_password_policy/__manifest__.py b/addons/auth_password_policy/__manifest__.py index 408849b7188..e7fc1a05caf 100644 --- a/addons/auth_password_policy/__manifest__.py +++ b/addons/auth_password_policy/__manifest__.py @@ -10,18 +10,12 @@ ], 'assets': { 'web.assets_backend': [ - 'auth_password_policy/static/src/password_meter.js', - 'auth_password_policy/static/src/password_field.js', - 'auth_password_policy/static/src/password_field.xml', + 'auth_password_policy/static/src/**/*', ], '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', - ], }, 'license': 'LGPL-3', } diff --git a/addons/bus/__manifest__.py b/addons/bus/__manifest__.py index 4d0bbb13e0a..b07c18ef443 100644 --- a/addons/bus/__manifest__.py +++ b/addons/bus/__manifest__.py @@ -10,7 +10,7 @@ 'installable': True, 'auto_install': True, 'assets': { - 'web.assets_common': [ + 'web.assets_backend': [ 'bus/static/src/*.js', 'bus/static/src/services/**/*.js', 'bus/static/src/workers/websocket_worker.js', diff --git a/addons/bus/static/src/services/presence_service.js b/addons/bus/static/src/services/presence_service.js index b8a298475e8..5d54da77aaa 100644 --- a/addons/bus/static/src/services/presence_service.js +++ b/addons/bus/static/src/services/presence_service.js @@ -2,17 +2,11 @@ import { browser } from "@web/core/browser/browser"; import { registry } from "@web/core/registry"; -import core from "@web/legacy/js/services/core"; export const presenceService = { start(env) { const LOCAL_STORAGE_PREFIX = "presence"; - // map window_focus event from the wowlBus to the legacy one. - env.bus.addEventListener("window_focus", (isOdooFocused) => { - core.bus.trigger("window_focus", isOdooFocused); - }); - let isOdooFocused = true; let lastPresenceTime = browser.localStorage.getItem(`${LOCAL_STORAGE_PREFIX}.lastPresence`) || diff --git a/addons/bus/tests/test_assetsbundle.py b/addons/bus/tests/test_assetsbundle.py index e5a246f0cee..61a5db5b034 100644 --- a/addons/bus/tests/test_assetsbundle.py +++ b/addons/bus/tests/test_assetsbundle.py @@ -15,16 +15,8 @@ class BusWebTests(odoo.tests.HttpCase): - The interface deals with those bus messages by displaying one notification """ db_name = self.env.registry.db_name - bundle_xml_ids = ('web.assets_common', 'web.assets_backend') - - domain = [] - for bundle in bundle_xml_ids: - domain = expression.OR([ - domain, - [('name', 'ilike', bundle + '%')] - ]) # start from a clean slate - self.env['ir.attachment'].search(domain).unlink() + self.env['ir.attachment'].search([('name', 'ilike', 'web.assets_backend%')]).unlink() self.env.registry.clear_cache() sendones = [] @@ -42,7 +34,7 @@ class BusWebTests(odoo.tests.HttpCase): # One sendone for each asset bundle and for each CSS / JS self.assertEqual( len(sendones), - 4, + 2, 'Received %s' % '\n'.join('%s - %s' % (tmp[0], tmp[1]) for tmp in sendones) ) for (channel, message) in sendones: diff --git a/addons/event/__manifest__.py b/addons/event/__manifest__.py index 7f0863d3cde..286b684cdfa 100644 --- a/addons/event/__manifest__.py +++ b/addons/event/__manifest__.py @@ -51,8 +51,6 @@ Key Features 'event/static/src/scss/event.scss', 'event/static/src/icon_selection_field/icon_selection_field.js', 'event/static/src/icon_selection_field/icon_selection_field.xml', - ], - 'web.assets_common': [ 'event/static/src/js/tours/**/*', ], 'web.assets_frontend': [ diff --git a/addons/im_livechat/__manifest__.py b/addons/im_livechat/__manifest__.py index becb944d1c0..aaa3b0e1251 100644 --- a/addons/im_livechat/__manifest__.py +++ b/addons/im_livechat/__manifest__.py @@ -107,29 +107,31 @@ Help your customers with this chat, and analyse their feedback. ('remove', 'im_livechat/static/src/embed/external/**/*'), ], 'im_livechat.assets_embed': [ + 'web/static/lib/jquery/jquery.js', + 'web/static/src/libs/fontawesome/css/font-awesome.css', 'im_livechat/static/src/embed/scss/bootstrap_overridden.scss', ('include', 'web._assets_helpers'), ('include', 'web._assets_backend_helpers'), - ('include', 'web.assets_common'), + 'web/static/src/scss/pre_variables.scss', + 'web/static/lib/bootstrap/scss/_variables.scss', ('include', 'web._assets_bootstrap_backend'), 'web/static/src/scss/bootstrap_overridden.scss', 'web/static/src/webclient/webclient.scss', - 'web/static/src/core/utils/transitions.scss', - 'web/static/src/core/**/*', - 'web/static/src/env.js', - ('remove', 'web/static/src/legacy/js/common_env.js'), - ('remove', 'web/static/src/core/emoji_picker/emoji_data.js'), + ('include', 'web._assets_core'), + 'web/static/src/libs/pdfjs.js', 'web/static/src/views/fields/formatters.js', 'web/static/src/views/fields/file_handler.*', - 'bus/static/src/bus_parameters_service.js', - ('remove', 'bus/static/src/services/assets_watchdog_service.js'), - ('remove', 'bus/static/src/simple_notification_service.js'), + 'bus/static/src/*.js', + 'bus/static/src/services/**/*.js', + ('remove', 'bus/static/src/services/legacy/**/*'), + 'bus/static/src/workers/websocket_worker.js', + 'bus/static/src/workers/websocket_worker_utils.js', ('include', 'im_livechat.assets_core'), 'im_livechat/static/src/embed/external/**/*', ], 'im_livechat.embed_test_assets': [ - ('include', 'web.assets_backend'), + ('include', 'web.assets_backend_tests'), ('include', 'web.tests_assets'), ('remove', 'web/static/tests/mock_server_tests.js'), ('remove', 'im_livechat/static/**'), diff --git a/addons/im_livechat/static/src/embed/external/session_legacy.js b/addons/im_livechat/static/src/embed/external/session_legacy.js deleted file mode 100644 index ce1bebfff96..00000000000 --- a/addons/im_livechat/static/src/embed/external/session_legacy.js +++ /dev/null @@ -1,6 +0,0 @@ -/* @odoo-module alias=web.session */ - -import Session from "@web/legacy/js/core/session"; -import { serverUrl } from "@im_livechat/embed/livechat_data"; - -export default new Session(undefined, serverUrl, { use_cors: true }); diff --git a/addons/im_livechat/views/webclient_templates.xml b/addons/im_livechat/views/webclient_templates.xml index d4ffc6b6de0..fdf7ea55495 100644 --- a/addons/im_livechat/views/webclient_templates.xml +++ b/addons/im_livechat/views/webclient_templates.xml @@ -11,8 +11,6 @@ - - diff --git a/addons/mail/__manifest__.py b/addons/mail/__manifest__.py index 0d3fb705dda..db249488b15 100644 --- a/addons/mail/__manifest__.py +++ b/addons/mail/__manifest__.py @@ -147,6 +147,10 @@ For more specific needs, you may also assign custom-defined actions 'mail/static/src/**/*.dark.scss', ], 'mail.assets_discuss_public_test_tours': [ + 'web_tour/static/src/tour_pointer/**/*', + # scss not needed in tests and depends on scss variables that are not in this bundle + ('remove', 'web_tour/static/src/tour_pointer/**/*.scss'), + 'web_tour/static/src/tour_service/**/*', 'web/static/tests/legacy/helpers/test_utils_file.js', 'mail/static/tests/tours/discuss_public_tour.js', 'mail/static/tests/tours/discuss_channel_as_guest_tour.js', @@ -166,26 +170,28 @@ For more specific needs, you may also assign custom-defined actions 'mail/static/lib/lame/lame.js', ], 'mail.assets_public': [ + 'web/static/lib/jquery/jquery.js', + 'web/static/src/libs/fontawesome/css/font-awesome.css', ('include', 'web._assets_helpers'), ('include', 'web._assets_backend_helpers'), - ('include', 'web.assets_common'), + 'web/static/src/scss/pre_variables.scss', + 'web/static/lib/bootstrap/scss/_variables.scss', ('include', 'web._assets_bootstrap_backend'), 'web/static/src/scss/bootstrap_overridden.scss', 'web/static/src/webclient/webclient.scss', - 'web/static/src/core/utils/transitions.scss', # included early because used by other files - 'web/static/src/core/**/*', - 'web/static/src/env.js', - ('remove', 'web/static/src/core/emoji_picker/emoji_data.js'), + 'web/static/src/scss/mimetypes.scss', + ('include', 'web._assets_core'), + 'web/static/src/libs/pdfjs.js', 'web/static/src/views/fields/formatters.js', 'web/static/src/views/fields/file_handler.*', - 'web/static/src/legacy/js/core/misc.js', - 'web/static/src/legacy/js/env.js', - 'web/static/src/legacy/js/owl_compatibility.js', - 'web/static/src/legacy/js/services/session.js', - 'web/static/src/legacy/utils.js', + 'bus/static/src/*.js', + 'bus/static/src/services/**/*.js', + ('remove', 'bus/static/src/services/legacy/**/*'), + 'bus/static/src/workers/websocket_worker.js', + 'bus/static/src/workers/websocket_worker_utils.js', + 'mail/static/src/core/common/**/*', - # 'mail/static/src/core/public/**/*', 'mail/static/src/**/common/**/*', 'mail/static/src/**/public/**/*', ('remove', 'mail/static/src/**/*.dark.scss'), diff --git a/addons/mail/static/src/core/common/attachment_view.js b/addons/mail/static/src/core/common/attachment_view.js index a9f38808dd5..2e77c16eb0b 100644 --- a/addons/mail/static/src/core/common/attachment_view.js +++ b/addons/mail/static/src/core/common/attachment_view.js @@ -3,7 +3,7 @@ import { Component, onWillUpdateProps, useEffect, useRef, useState } from "@odoo/owl"; import { useService } from "@web/core/utils/hooks"; -import { hidePDFJSButtons } from "@web/legacy/js/libs/pdfjs"; +import { hidePDFJSButtons } from "@web/libs/pdfjs"; /** * @typedef {Object} Props diff --git a/addons/mail/static/src/discuss/core/public/boot.js b/addons/mail/static/src/discuss/core/public/boot.js index 4d772441ea6..aa9e3c1fcab 100644 --- a/addons/mail/static/src/discuss/core/public/boot.js +++ b/addons/mail/static/src/discuss/core/public/boot.js @@ -3,16 +3,12 @@ import { DiscussPublic } from "@mail/discuss/core/public/discuss_public"; import { data } from "mail.discuss_public_template"; -import { Component, mount, whenReady } from "@odoo/owl"; +import { mount, whenReady } from "@odoo/owl"; import { templates } from "@web/core/assets"; import { MainComponentsContainer } from "@web/core/main_components_container"; import { registry } from "@web/core/registry"; import { makeEnv, startServices } from "@web/env"; -import { mapLegacyEnvToWowlEnv } from "@web/legacy/utils"; -import legacyEnv from "@web/legacy/js/env"; - -Component.env = legacyEnv; (async function boot() { await whenReady(); @@ -26,7 +22,6 @@ Component.env = legacyEnv; const env = makeEnv(); await startServices(env); env.services["mail.store"].inPublicPage = true; - mapLegacyEnvToWowlEnv(Component.env, env); odoo.isReady = true; await mount(MainComponentsContainer, document.body, { env, templates, dev: env.debug }); })(); diff --git a/addons/mail/static/src/discuss/core/public/root_widget.js b/addons/mail/static/src/discuss/core/public/root_widget.js deleted file mode 100644 index 8ed02ae4045..00000000000 --- a/addons/mail/static/src/discuss/core/public/root_widget.js +++ /dev/null @@ -1,14 +0,0 @@ -/* @odoo-module alias=root.widget */ -/** - * This module exists so that web_tour can use it as the parent of the - * TourManager so it can get access to _trigger_up. - */ -// need to wait for owl.Component.env to be set by new/public/boot before -// we spawn the component adapter -import "@mail/discuss/core/public/boot"; - -import { Component } from "@odoo/owl"; - -import { standaloneAdapter } from "@web/legacy/js/owl_compatibility"; - -export default standaloneAdapter({ Component }); diff --git a/addons/mass_mailing/__manifest__.py b/addons/mass_mailing/__manifest__.py index ea28dad1d80..55f7e5452b8 100644 --- a/addons/mass_mailing/__manifest__.py +++ b/addons/mass_mailing/__manifest__.py @@ -117,6 +117,7 @@ 'mass_mailing/static/src/js/mailing_mailing_view_form_full_width.js', 'mass_mailing/static/src/xml/mailing_filter_widget.xml', 'mass_mailing/static/src/xml/mass_mailing.xml', + 'mass_mailing/static/src/js/tours/**/*', ], 'mass_mailing.assets_mail_themes': [ 'mass_mailing/static/src/scss/themes/**/*', @@ -137,9 +138,6 @@ 'web_editor.assets_legacy_wysiwyg': [ 'mass_mailing/static/src/js/snippets.editor.js', ], - 'web.assets_common': [ - 'mass_mailing/static/src/js/tours/**/*', - ], 'web.assets_frontend': [ 'mass_mailing/static/src/js/tours/**/*', ], diff --git a/addons/mrp_subcontracting/__manifest__.py b/addons/mrp_subcontracting/__manifest__.py index 5f87f137dcb..4a847ac215e 100644 --- a/addons/mrp_subcontracting/__manifest__.py +++ b/addons/mrp_subcontracting/__manifest__.py @@ -43,12 +43,100 @@ 'web/static/src/scss/pre_variables.scss', 'web/static/lib/bootstrap/scss/_variables.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/src/webclient/navbar/navbar.scss', + 'web/static/src/scss/animation.scss', + 'web/static/src/core/colorpicker/colorpicker.scss', + 'web/static/src/scss/mimetypes.scss', + 'web/static/src/legacy/scss/ui.scss', + 'web/static/src/legacy/scss/modal.scss', + 'web/static/src/views/fields/translation_dialog.scss', + 'web/static/src/legacy/scss/name_and_signature.scss', + 'web/static/src/scss/fontawesome_overridden.scss', + + '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/lib/moment/moment.js', + 'web/static/lib/luxon/luxon.js', + 'web/static/lib/owl/owl.js', + 'web/static/lib/owl/odoo_module.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.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/select2/select2.js', + 'web/static/lib/clipboard/clipboard.js', + 'web/static/lib/jSignature/jSignatureCustom.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/jquery.js', + 'web/static/src/legacy/js/libs/moment.js', + 'web/static/src/legacy/js/libs/jSignatureCustom.js', + 'web/static/src/legacy/js/core/ajax.js', + 'web/static/src/legacy/js/core/bus.js', + 'web/static/src/legacy/js/core/class.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/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/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/config.js', + 'web/static/src/legacy/js/services/core.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', + ('include', 'web._assets_bootstrap'), 'base/static/src/css/modules.css', 'web/static/src/core/utils/transitions.scss', 'web/static/src/core/**/*', + ('remove', 'web/static/src/core/emoji_picker/emoji_data.js'), 'web/static/src/search/**/*', 'web/static/src/views/*.js', 'web/static/src/views/*.xml', @@ -63,7 +151,6 @@ 'web/static/src/views/view_dialogs/**/*', 'web/static/src/views/widgets/**/*', 'web/static/src/webclient/**/*', - ('remove', 'web/static/src/webclient/navbar/navbar.scss'), # already in assets_common ('remove', 'web/static/src/webclient/clickbot/clickbot.js'), # lazy loaded ('remove', 'web/static/src/views/form/button_box/*.scss'), @@ -77,8 +164,6 @@ 'web/static/lib/jquery.ba-bbq/jquery.ba-bbq.js', 'web/static/src/legacy/scss/fields.scss', - 'web/static/src/legacy/scss/form_view.scss', - 'web/static/src/legacy/scss/list_view.scss', 'base/static/src/scss/res_partner.scss', @@ -103,7 +188,6 @@ 'mrp_subcontracting/static/src/subcontracting_portal/*', 'web/static/src/start.js', 'web/static/src/legacy/legacy_setup.js', - ('remove', 'web/static/src/core/emoji_picker/emoji_data.js'), ], }, 'uninstall_hook': 'uninstall_hook', diff --git a/addons/mrp_subcontracting/views/subcontracting_portal_templates.xml b/addons/mrp_subcontracting/views/subcontracting_portal_templates.xml index 0dfccf97bd8..74f477440f3 100644 --- a/addons/mrp_subcontracting/views/subcontracting_portal_templates.xml +++ b/addons/mrp_subcontracting/views/subcontracting_portal_templates.xml @@ -72,10 +72,7 @@ odoo.__session_info__ = ; - - - - + diff --git a/addons/point_of_sale/__manifest__.py b/addons/point_of_sale/__manifest__.py index cfbcca640cd..dc257942f68 100644 --- a/addons/point_of_sale/__manifest__.py +++ b/addons/point_of_sale/__manifest__.py @@ -104,12 +104,7 @@ # JS framework - 'web/static/src/boot.js', - 'web/static/src/session.js', - 'web/static/src/env.js', - 'web/static/src/core/utils/transitions.scss', # needs to be loaded before other scss files - 'web/static/src/core/**/*', - ('remove', 'web/static/src/core/emoji_picker/emoji_data.js'), + ('include', 'web._assets_core'), ('remove', 'web/static/src/core/errors/error_handlers.js'), # error handling in PoS is different from the webclient # formatMonetary 'web/static/src/views/fields/formatters.js', @@ -132,9 +127,6 @@ 'web/static/src/webclient/actions/reports/utils.js', # libs 'point_of_sale/static/lib/**/*', - 'web/static/lib/luxon/luxon.js', - 'web/static/lib/owl/owl.js', - 'web/static/lib/owl/odoo_module.js', 'web_editor/static/lib/html2canvas.js', 'web/static/lib/zxing-library/zxing-library.js', # PoS files diff --git a/addons/pos_self_order/__manifest__.py b/addons/pos_self_order/__manifest__.py index c79b8b5edc3..571fe6418ce 100644 --- a/addons/pos_self_order/__manifest__.py +++ b/addons/pos_self_order/__manifest__.py @@ -31,17 +31,9 @@ "web/static/lib/bootstrap/scss/_variables.scss", ("include", "web._assets_bootstrap"), ("include", "web._assets_bootstrap_backend"), - "web/static/src/boot.js", - "web/static/src/env.js", - "web/static/src/session.js", - "web/static/src/core/utils/transitions.scss", - "web/static/src/core/**/*", - ('remove', 'web/static/src/core/emoji_picker/emoji_data.js'), + ('include', 'web._assets_core'), ("remove", "web/static/src/core/browser/router_service.js"), ("remove", "web/static/src/core/debug/**/*"), - "web/static/lib/owl/owl.js", - "web/static/lib/owl/odoo_module.js", - "web/static/lib/luxon/luxon.js", "web/static/src/views/fields/formatters.js", "web/static/src/libs/fontawesome/css/font-awesome.css", "web/static/lib/odoo_ui_icons/*", diff --git a/addons/project/__manifest__.py b/addons/project/__manifest__.py index 947fee88209..3de25979b0e 100644 --- a/addons/project/__manifest__.py +++ b/addons/project/__manifest__.py @@ -94,6 +94,92 @@ 'web/static/src/scss/pre_variables.scss', 'web/static/lib/bootstrap/scss/_variables.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/src/webclient/navbar/navbar.scss', + 'web/static/src/scss/animation.scss', + 'web/static/src/core/colorpicker/colorpicker.scss', + 'web/static/src/scss/mimetypes.scss', + 'web/static/src/legacy/scss/ui.scss', + 'web/static/src/legacy/scss/modal.scss', + 'web/static/src/views/fields/translation_dialog.scss', + 'web/static/src/legacy/scss/name_and_signature.scss', + 'web/static/src/scss/fontawesome_overridden.scss', + + '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/lib/moment/moment.js', + 'web/static/lib/luxon/luxon.js', + 'web/static/lib/owl/owl.js', + 'web/static/lib/owl/odoo_module.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.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/select2/select2.js', + 'web/static/lib/clipboard/clipboard.js', + 'web/static/lib/jSignature/jSignatureCustom.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/jquery.js', + 'web/static/src/legacy/js/libs/moment.js', + 'web/static/src/legacy/js/libs/jSignatureCustom.js', + 'web/static/src/legacy/js/core/ajax.js', + 'web/static/src/legacy/js/core/bus.js', + 'web/static/src/legacy/js/core/class.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/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/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/config.js', + 'web/static/src/legacy/js/services/core.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', ('include', 'web._assets_bootstrap_backend'), 'base/static/src/css/modules.css', @@ -115,7 +201,6 @@ 'web/static/src/views/view_dialogs/**/*', 'web/static/src/views/widgets/**/*', 'web/static/src/webclient/**/*', - ('remove', 'web/static/src/webclient/navbar/navbar.scss'), # already in assets_common ('remove', 'web/static/src/webclient/clickbot/clickbot.js'), # lazy loaded ('remove', 'web/static/src/views/form/button_box/*.scss'), ('remove', 'web/static/src/core/emoji_picker/emoji_data.js'), @@ -151,6 +236,13 @@ 'web/static/src/legacy/js/env.js', 'web/static/src/legacy/js/owl_compatibility.js', + '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/components/**/*', 'web_editor/static/src/scss/web_editor.common.scss', 'web_editor/static/src/scss/web_editor.backend.scss', diff --git a/addons/project/views/project_sharing_project_task_templates.xml b/addons/project/views/project_sharing_project_task_templates.xml index 1e23d82b837..b883f0d3291 100644 --- a/addons/project/views/project_sharing_project_task_templates.xml +++ b/addons/project/views/project_sharing_project_task_templates.xml @@ -24,10 +24,7 @@ odoo.loadMenusPromise = Promise.resolve(); - - - - + diff --git a/addons/stock/__manifest__.py b/addons/stock/__manifest__.py index 104c1dbfb75..e89b9472cc6 100644 --- a/addons/stock/__manifest__.py +++ b/addons/stock/__manifest__.py @@ -100,9 +100,6 @@ 'stock/static/src/scss/report_stock_reception.scss', 'stock/static/src/scss/report_stock_rule.scss', ], - 'web.assets_common': [ - 'stock/static/src/scss/stock_traceability_report.scss', - ], 'web.assets_backend': [ 'stock/static/src/**/*.js', 'stock/static/src/**/*.xml', diff --git a/addons/survey/__manifest__.py b/addons/survey/__manifest__.py index 516e5c702e6..45364e3c95d 100644 --- a/addons/survey/__manifest__.py +++ b/addons/survey/__manifest__.py @@ -98,6 +98,7 @@ sent mails with personal token for the invitation of the survey. 'survey/static/src/scss/survey_survey_views.scss', 'survey/static/src/scss/survey_question_views.scss', 'survey/static/src/scss/survey_templates_results.scss', + 'survey/static/src/js/tours/survey_tour.js', ], "web.dark_mode_assets_backend": [ 'survey/static/src/scss/*.dark.scss', @@ -108,9 +109,6 @@ sent mails with personal token for the invitation of the survey. 'web.qunit_suite_tests': [ 'survey/static/tests/components/*.js', ], - 'web.assets_common': [ - 'survey/static/src/js/tours/survey_tour.js', - ], 'web.assets_frontend': [ 'survey/static/src/js/tours/survey_tour.js', ], diff --git a/addons/web/__manifest__.py b/addons/web/__manifest__.py index 323748b8914..0ac54b77e6e 100644 --- a/addons/web/__manifest__.py +++ b/addons/web/__manifest__.py @@ -36,21 +36,19 @@ This module provides the core of the Odoo Web Client. # 3) an arbitrary name, relevant to the content of the bundle. # # Examples: - # > web.assets_common = assets common to backend clients and others - # (not frontend). # > web_editor.assets_legacy_wysiwyg = assets needed by components defined in the "web_editor" module. - # 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': [ + 'web.assets_emoji': [ + 'web/static/src/core/emoji_picker/emoji_data.js' + ], + 'web.assets_backend': [ ('include', 'web._assets_helpers'), - + ('include', 'web._assets_backend_helpers'), 'web/static/src/scss/pre_variables.scss', 'web/static/lib/bootstrap/scss/_variables.scss', + ('include', 'web._assets_bootstrap_backend'), + + ('include', 'web._assets_core'), 'web/static/lib/jquery.ui/jquery-ui.css', 'web/static/src/libs/fontawesome/css/font-awesome.css', @@ -61,22 +59,15 @@ This module provides the core of the Odoo Web Client. 'web/static/src/scss/animation.scss', 'web/static/src/scss/fontawesome_overridden.scss', 'web/static/src/scss/mimetypes.scss', - 'web/static/src/core/colorpicker/colorpicker.scss', 'web/static/src/views/fields/translation_dialog.scss', 'web/static/src/legacy/scss/ui.scss', 'web/static/src/legacy/scss/modal.scss', 'web/static/src/legacy/scss/name_and_signature.scss', '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/lib/moment/moment.js', - 'web/static/lib/luxon/luxon.js', - 'web/static/lib/owl/owl.js', - 'web/static/lib/owl/odoo_module.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', @@ -113,7 +104,6 @@ This module provides the core of the Odoo Web Client. 'web/static/src/legacy/js/libs/download.js', 'web/static/src/legacy/js/libs/jquery.js', 'web/static/src/legacy/js/libs/moment.js', - 'web/static/src/legacy/js/libs/pdfjs.js', 'web/static/src/legacy/js/libs/jSignatureCustom.js', 'web/static/src/legacy/js/core/ajax.js', 'web/static/src/legacy/js/core/bus.js', @@ -139,40 +129,24 @@ This module provides the core of the Odoo Web Client. '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.assets_emoji': [ - 'web/static/src/core/emoji_picker/emoji_data.js' - ], - 'web.assets_backend': [ - ('include', 'web._assets_helpers'), - ('include', 'web._assets_backend_helpers'), - - 'web/static/src/scss/pre_variables.scss', - 'web/static/lib/bootstrap/scss/_variables.scss', - - ('include', 'web._assets_bootstrap_backend'), 'base/static/src/css/modules.css', 'web/static/src/core/utils/transitions.scss', - 'web/static/src/core/**/*', 'web/static/src/model/**/*', 'web/static/src/search/**/*', 'web/static/src/webclient/icons.scss', # variables required in list_controller.scss 'web/static/src/views/**/*', 'web/static/src/webclient/**/*', - ('remove', 'web/static/src/webclient/navbar/navbar.scss'), # already in assets_common ('remove', 'web/static/src/webclient/clickbot/clickbot.js'), # lazy loaded ('remove', 'web/static/src/views/form/button_box/*.scss'), - ('remove', 'web/static/src/core/file_viewer/file_viewer.dark.scss'), - ('remove', 'web/static/src/core/emoji_picker/emoji_data.js'), # remove the report code and whitelist only what's needed ('remove', 'web/static/src/webclient/actions/reports/**/*'), 'web/static/src/webclient/actions/reports/*.js', 'web/static/src/webclient/actions/reports/*.xml', - 'web/static/src/env.js', + 'web/static/src/libs/pdfjs.js', 'web/static/lib/jquery.ba-bbq/jquery.ba-bbq.js', @@ -295,7 +269,6 @@ This module provides the core of the Odoo Web Client. 'web/static/src/legacy/js/libs/download.js', 'web/static/src/legacy/js/libs/jquery.js', 'web/static/src/legacy/js/libs/moment.js', - 'web/static/src/legacy/js/libs/pdfjs.js', 'web/static/src/legacy/js/libs/jSignatureCustom.js', 'web/static/src/legacy/js/core/ajax.js', 'web/static/src/legacy/js/core/bus.js', @@ -330,6 +303,7 @@ This module provides the core of the Odoo Web Client. ('remove', 'web/static/src/core/file_viewer/file_viewer.dark.scss'), ('remove', 'web/static/src/core/emoji_picker/emoji_data.js'), 'web/static/src/public/error_notifications.js', + 'web/static/src/libs/pdfjs.js', 'web/static/src/legacy/utils.js', 'web/static/src/legacy/js/core/dates.js', @@ -425,10 +399,6 @@ This module provides the core of the Odoo Web Client. # --------------------------------------------------------------------- # COLOR SCHEME BUNDLES # --------------------------------------------------------------------- - "web.dark_mode_assets_common": [ - ('include', 'web.assets_common'), - 'web/static/src/core/file_viewer/file_viewer.dark.scss', - ], "web.dark_mode_assets_backend": [ ('include', 'web.assets_backend'), 'web/static/src/**/*.dark.scss', @@ -443,10 +413,23 @@ This module provides the core of the Odoo Web Client. # Their naming conventions are similar to those of the main bundles, # with the addition of a prefixed underscore to reflect the "private" # aspect. - # - # Examples: - # > web._assets_helpers = define assets needed in most main bundles + # Bare javascript essentials: module loader, core folder and core libs + 'web._assets_core': [ + # module loader + 'web/static/src/boot.js', + # libs + 'web/static/lib/luxon/luxon.js', + 'web/static/lib/owl/owl.js', + 'web/static/src/owl2_compatibility/*.js', + 'web/static/lib/owl/odoo_module.js', + # core + 'web/static/src/env.js', + 'web/static/src/session.js', + 'web/static/src/core/utils/transitions.scss', + 'web/static/src/core/**/*', + ('remove', 'web/static/src/core/emoji_picker/emoji_data.js'), # always lazy-loaded + ], 'web._assets_primary_variables': [ 'web/static/src/scss/primary_variables.scss', 'web/static/src/**/*.variables.scss', @@ -504,8 +487,8 @@ This module provides the core of the Odoo Web Client. 'web/static/tests/ignore_missing_deps_stop.js', ], # remove this bundle alongside the owl2 compatibility layer - 'web.tests_assets_common': [ - ('include', 'web.assets_common'), + 'web.assets_backend_tests': [ + ('include', 'web.assets_backend'), ('after', 'web/static/src/owl2_compatibility/app.js', 'web/static/tests/owl2_compatibility_app.js'), ], 'web.tests_assets': [ diff --git a/addons/web/static/src/legacy/js/libs/pdfjs.js b/addons/web/static/src/legacy/js/libs/pdfjs.js deleted file mode 100644 index a7d60209f33..00000000000 --- a/addons/web/static/src/legacy/js/libs/pdfjs.js +++ /dev/null @@ -1,66 +0,0 @@ -/** @odoo-module **/ - -import config from '@web/legacy/js/services/config'; - -/** - * Until we have our own implementation of the /web/static/lib/pdfjs/web/viewer.{html,js,css} - * (currently based on Firefox), this method allows us to hide the buttons that we do not want: - * * "Open File" - * * "View Bookmark" - * * "Print" (Hidden on mobile device like Android, iOS, ...) - * * "Download" (Hidden on mobile device like Android, iOS, ...) - * - * @link https://mozilla.github.io/pdf.js/getting_started/ - * - * @param {Element} rootElement - */ -export function hidePDFJSButtons(rootElement) { - const cssStyle = document.createElement("style"); - cssStyle.rel = "stylesheet"; - cssStyle.innerHTML = `button#secondaryOpenFile.secondaryToolbarButton, button#openFile.toolbarButton, -a#secondaryViewBookmark.secondaryToolbarButton, a#viewBookmark.toolbarButton { -display: none !important; -}`; - if (config.device.isMobileDevice) { - cssStyle.innerHTML = `${cssStyle.innerHTML} -button#secondaryDownload.secondaryToolbarButton, button#download.toolbarButton, -button#secondaryPrint.secondaryToolbarButton, button#print.toolbarButton{ -display: none !important; -}`; - } - const iframe = rootElement.tagName === 'IFRAME' ? rootElement : rootElement.querySelector('iframe'); - if (iframe) { - if (!iframe.dataset.hideButtons) { - iframe.dataset.hideButtons = 'true'; - iframe.addEventListener('load', event => { - if (iframe.contentDocument && iframe.contentDocument.head) { - iframe.contentDocument.head.appendChild(cssStyle); - } - }); - } - } else { - console.warn('No IFRAME found'); - } -} - -/* -* List of changes made in the library -* There is no changes to pdf.js in this section, but only a note about changes that has been done in /web/static/lib/pdfjs/. -* -* In the module account_invoice_extract, the code need to react to the 'pagerendered' event triggered by -* pdf.js. However in recent version of pdf.js, event are not visible outside of the library, except if the -* 'eventBusDispatchToDOM' has been set to true. -* -* We tried to set this option from outside of the library but without success, as our pdf viewer is in an iframe. -* There is no state of the iframe in which we can add an event listener to set the option. -* pdf.js has an event used to signal when we can set settings, called 'webviewerloaded'. -* This event is triggered in an EventListener attached to the 'DOMContentLoaded' event. -* So, to list options we had, we could: -* a) add an eventListener to the iframe document or window to react to 'webviewerloaded'. This doesn't work as -* document and windows are not the definitive ones and won't catche the event later. -* b) add an eventListener to the iframe to react to 'DOMContentLoaded', which doens't work too as our listener will be called -* after the pdf.js one. -* -* Finally the option was choosed to modify the default value of this option directly in pdf.js as no hook worked in the -* 'account_invoice_extract' module. -*/ diff --git a/addons/web/static/src/legacy/scss/ui.scss b/addons/web/static/src/legacy/scss/ui.scss index 1a90e27be0e..c5410a0cf91 100644 --- a/addons/web/static/src/legacy/scss/ui.scss +++ b/addons/web/static/src/legacy/scss/ui.scss @@ -206,9 +206,8 @@ span.o_force_ltr { color: #FFFFFF; font-size: 1rem; - // Needed as the parent button could be using font-awesome. - // Can't be put to a BS variable here as we are in assets common (will be - // overridden for backend but left with 'sans-serif' for frontend to not - // have an useless frontend rule. + // Needed as the parent button could be using font-awesome. Can't be put to a BS variable here + // as this file will be included in both backend and frontend, and will be overridden for + // backend but left with 'sans-serif' for frontend to not have an useless frontend rule. font-family: sans-serif; } diff --git a/addons/web/static/src/libs/pdfjs.js b/addons/web/static/src/libs/pdfjs.js new file mode 100644 index 00000000000..fae2115ddcf --- /dev/null +++ b/addons/web/static/src/libs/pdfjs.js @@ -0,0 +1,67 @@ +/** @odoo-module **/ + +import { isMobileOS } from "@web/core/browser/feature_detection"; + +/** + * Until we have our own implementation of the /web/static/lib/pdfjs/web/viewer.{html,js,css} + * (currently based on Firefox), this method allows us to hide the buttons that we do not want: + * * "Open File" + * * "View Bookmark" + * * "Print" (Hidden on mobile device like Android, iOS, ...) + * * "Download" (Hidden on mobile device like Android, iOS, ...) + * + * @link https://mozilla.github.io/pdf.js/getting_started/ + * + * @param {Element} rootElement + */ +export function hidePDFJSButtons(rootElement) { + const cssStyle = document.createElement("style"); + cssStyle.rel = "stylesheet"; + cssStyle.textContent = `button#secondaryOpenFile.secondaryToolbarButton, button#openFile.toolbarButton, +a#secondaryViewBookmark.secondaryToolbarButton, a#viewBookmark.toolbarButton { +display: none !important; +}`; + if (isMobileOS()) { + cssStyle.textContent = `${cssStyle.innerHTML} +button#secondaryDownload.secondaryToolbarButton, button#download.toolbarButton, +button#secondaryPrint.secondaryToolbarButton, button#print.toolbarButton{ +display: none !important; +}`; + } + const iframe = + rootElement.tagName === "IFRAME" ? rootElement : rootElement.querySelector("iframe"); + if (iframe) { + if (!iframe.dataset.hideButtons) { + iframe.dataset.hideButtons = "true"; + iframe.addEventListener("load", (event) => { + if (iframe.contentDocument && iframe.contentDocument.head) { + iframe.contentDocument.head.appendChild(cssStyle); + } + }); + } + } else { + console.warn("No IFRAME found"); + } +} + +/* + * List of changes made in the library + * There is no changes to pdf.js in this section, but only a note about changes that has been done in /web/static/lib/pdfjs/. + * + * In the module account_invoice_extract, the code need to react to the 'pagerendered' event triggered by + * pdf.js. However in recent version of pdf.js, event are not visible outside of the library, except if the + * 'eventBusDispatchToDOM' has been set to true. + * + * We tried to set this option from outside of the library but without success, as our pdf viewer is in an iframe. + * There is no state of the iframe in which we can add an event listener to set the option. + * pdf.js has an event used to signal when we can set settings, called 'webviewerloaded'. + * This event is triggered in an EventListener attached to the 'DOMContentLoaded' event. + * So, to list options we had, we could: + * a) add an eventListener to the iframe document or window to react to 'webviewerloaded'. This doesn't work as + * document and windows are not the definitive ones and won't catche the event later. + * b) add an eventListener to the iframe to react to 'DOMContentLoaded', which doens't work too as our listener will be called + * after the pdf.js one. + * + * Finally the option was choosed to modify the default value of this option directly in pdf.js as no hook worked in the + * 'account_invoice_extract' module. + */ diff --git a/addons/web/static/src/scss/bs_mixins_overrides.scss b/addons/web/static/src/scss/bs_mixins_overrides.scss index 01992118eef..a23ba2860da 100644 --- a/addons/web/static/src/scss/bs_mixins_overrides.scss +++ b/addons/web/static/src/scss/bs_mixins_overrides.scss @@ -4,7 +4,7 @@ //------------------------------------------------------------------------------ // This variable must be defined here instead of bootstrap overridden files -// otherwise we will have deprecation messages for assets_common generation +// otherwise we will have deprecation messages during assets generation $enable-deprecation-messages: false !default; // Override color-contrast function to handle the alpha component of colors diff --git a/addons/web/static/src/views/fields/file_handler.xml b/addons/web/static/src/views/fields/file_handler.xml index c5ed3cb6b96..58a35fbee71 100644 --- a/addons/web/static/src/views/fields/file_handler.xml +++ b/addons/web/static/src/views/fields/file_handler.xml @@ -11,7 +11,7 @@ type="file" t-att-name="props.inputName" t-ref="fileInput" - t-attf-class="o_input_file o_hidden {{ props.fileUploadClass or '' }}" + t-attf-class="o_input_file d-none {{ props.fileUploadClass or '' }}" t-att-multiple="props.multiUpload ? 'multiple' : false" t-att-accept="props.acceptedFileExtensions or '*'" t-on-change="onFileChange" /> diff --git a/addons/web/views/webclient_templates.xml b/addons/web/views/webclient_templates.xml index b924c1560fb..cfb2b8acf43 100644 --- a/addons/web/views/webclient_templates.xml +++ b/addons/web/views/webclient_templates.xml @@ -210,10 +210,7 @@ Web Tests - - - - + @@ -232,10 +229,7 @@ - - - - + @@ -271,15 +265,11 @@ } - - + - - + - - diff --git a/addons/web_editor/__manifest__.py b/addons/web_editor/__manifest__.py index 402824f48e6..3b8f7fe3bbc 100644 --- a/addons/web_editor/__manifest__.py +++ b/addons/web_editor/__manifest__.py @@ -28,7 +28,97 @@ Odoo Web Editor widget. 'web_editor/static/src/js/editor/smooth_scroll_on_drag.js', ], 'web_editor.wysiwyg_iframe_editor_assets': [ - ('include', 'web.assets_common'), + ('include', 'web._assets_helpers'), + + 'web/static/src/scss/pre_variables.scss', + 'web/static/lib/bootstrap/scss/_variables.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/src/webclient/navbar/navbar.scss', + 'web/static/src/scss/animation.scss', + 'web/static/src/core/colorpicker/colorpicker.scss', + 'web/static/src/scss/mimetypes.scss', + 'web/static/src/legacy/scss/ui.scss', + 'web/static/src/legacy/scss/modal.scss', + 'web/static/src/views/fields/translation_dialog.scss', + 'web/static/src/legacy/scss/name_and_signature.scss', + 'web/static/src/scss/fontawesome_overridden.scss', + + '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/lib/moment/moment.js', + 'web/static/lib/luxon/luxon.js', + 'web/static/lib/owl/owl.js', + 'web/static/lib/owl/odoo_module.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.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/select2/select2.js', + 'web/static/lib/clipboard/clipboard.js', + 'web/static/lib/jSignature/jSignatureCustom.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/jquery.js', + 'web/static/src/legacy/js/libs/moment.js', + 'web/static/src/legacy/js/libs/jSignatureCustom.js', + 'web/static/src/legacy/js/core/ajax.js', + 'web/static/src/legacy/js/core/bus.js', + 'web/static/src/legacy/js/core/class.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/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/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/config.js', + 'web/static/src/legacy/js/services/core.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', ('include', 'web_editor.assets_wysiwyg'), ('include', 'web_editor.assets_legacy_wysiwyg'), ], @@ -107,15 +197,14 @@ Odoo Web Editor widget. 'web_editor/static/src/xml/wysiwyg.xml', 'web_editor/static/src/xml/wysiwyg_colorpicker.xml', ], - 'web.assets_common': [ + 'web.assets_backend': [ '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.assets_backend': [ + ('include', 'web_editor.assets_media_dialog'), # TODO: remove when refactoring 'DatetimePickerUserValueWidget' diff --git a/addons/web_tour/__manifest__.py b/addons/web_tour/__manifest__.py index 0be3c54cd92..71ad0884b8a 100644 --- a/addons/web_tour/__manifest__.py +++ b/addons/web_tour/__manifest__.py @@ -17,14 +17,8 @@ Odoo Web tours. 'views/tour_views.xml' ], 'assets': { - 'web.assets_common': [ - 'web_tour/static/src/tour_pointer/**/*', - 'web_tour/static/src/tour_service/**/*', - ], 'web.assets_backend': [ - 'web_tour/static/src/debug/debug_manager.js', - 'web_tour/static/src/debug/tour_dialog_component.js', - 'web_tour/static/src/debug/tour_dialog_component.xml', + 'web_tour/static/src/**/*', ], 'web.assets_frontend': [ 'web_tour/static/src/tour_pointer/**/*', diff --git a/addons/website/__manifest__.py b/addons/website/__manifest__.py index eafe252c127..183db7fb8cf 100644 --- a/addons/website/__manifest__.py +++ b/addons/website/__manifest__.py @@ -173,6 +173,7 @@ 'website/static/src/scss/website.backend.scss', 'website/static/src/scss/website_visitor_views.scss', 'website/static/src/js/backend/**/*', + 'website/static/src/js/tours/tour_utils.js', 'website/static/src/client_actions/*/*', ('remove', 'website/static/src/client_actions/website_preview/website_preview_test_mode.js'), 'website/static/src/components/fields/*', @@ -195,9 +196,6 @@ 'website/static/src/client_actions/*/*.dark.scss', 'website/static/src/components/website_loader/website_loader.dark.scss' ], - 'web.assets_common': [ - 'website/static/src/js/tours/tour_utils.js', - ], 'web.qunit_suite_tests': [ 'website/static/tests/redirect_field_tests.js', ], diff --git a/addons/website_event/__manifest__.py b/addons/website_event/__manifest__.py index aec751560fc..7c5342b0823 100644 --- a/addons/website_event/__manifest__.py +++ b/addons/website_event/__manifest__.py @@ -49,7 +49,7 @@ ], 'application': True, 'assets': { - 'web.assets_common': [ + 'web.assets_backend': [ 'website_event/static/src/js/tours/**/*', ], 'web.assets_tests': [ diff --git a/addons/website_forum/__manifest__.py b/addons/website_forum/__manifest__.py index 529353ecb91..0cf203744da 100644 --- a/addons/website_forum/__manifest__.py +++ b/addons/website_forum/__manifest__.py @@ -66,7 +66,7 @@ Ask questions, get answers, no distractions 'web.assets_tests': [ 'website_forum/static/tests/**/*', ], - 'web.assets_common': [ + 'web.assets_backend': [ 'website_forum/static/src/js/tours/website_forum.js', ], 'web.assets_frontend': [ diff --git a/addons/website_sale/__manifest__.py b/addons/website_sale/__manifest__.py index a44e0de3640..617a1f00ab7 100644 --- a/addons/website_sale/__manifest__.py +++ b/addons/website_sale/__manifest__.py @@ -87,6 +87,7 @@ 'website_sale/static/src/scss/primary_variables.scss', ], 'web.assets_backend': [ + 'website_sale/static/src/js/tours/tour_utils.js', 'website_sale/static/src/js/website_sale_video_field_preview.js', 'website_sale/static/src/scss/website_sale_backend.scss', 'website_sale/static/src/js/tours/website_sale_shop.js', @@ -104,9 +105,6 @@ 'website_sale/static/src/js/components/wysiwyg_adapter/wysiwyg_adapter.js', 'website_sale/static/src/xml/website_sale_utils.xml', ], - 'web.assets_common': [ - 'website_sale/static/src/js/tours/tour_utils.js', - ], 'web.assets_tests': [ 'website_sale/static/tests/**/*', ], diff --git a/addons/website_slides/__manifest__.py b/addons/website_slides/__manifest__.py index 0fe431130c7..a36666980f4 100644 --- a/addons/website_slides/__manifest__.py +++ b/addons/website_slides/__manifest__.py @@ -196,7 +196,6 @@ Featuring 'web/static/src/legacy/js/libs/download.js', 'web/static/src/legacy/js/libs/jquery.js', 'web/static/src/legacy/js/libs/moment.js', - 'web/static/src/legacy/js/libs/pdfjs.js', 'website/static/src/libs/zoomodoo/zoomodoo.js', 'web/static/src/legacy/js/libs/jSignatureCustom.js', 'web/static/src/legacy/js/core/ajax.js', @@ -225,6 +224,7 @@ Featuring 'web/static/src/legacy/xml/name_and_signature.xml', 'web/static/src/core/**/*.js', 'web/static/src/env.js', + 'web/static/src/libs/pdfjs.js', 'web/static/src/legacy/js/services/session.js', ('remove', 'web/static/src/core/emoji_picker/emoji_data.js'), diff --git a/addons/website_slides/views/website_slides_templates_lesson_embed.xml b/addons/website_slides/views/website_slides_templates_lesson_embed.xml index 7de33d130df..5e1ae8f6fd2 100644 --- a/addons/website_slides/views/website_slides_templates_lesson_embed.xml +++ b/addons/website_slides/views/website_slides_templates_lesson_embed.xml @@ -9,7 +9,6 @@ <t t-esc="slide.name"/> - diff --git a/odoo/addons/base/models/assetsbundle.py b/odoo/addons/base/models/assetsbundle.py index fe631138734..e39d6c43982 100644 --- a/odoo/addons/base/models/assetsbundle.py +++ b/odoo/addons/base/models/assetsbundle.py @@ -55,7 +55,7 @@ class AssetsBundle(object): rx_preprocess_imports = re.compile("""(@import\s?['"]([^'"]+)['"](;?))""") rx_css_split = re.compile("\/\*\! ([a-f0-9-]+) \*\/") - TRACKED_BUNDLES = ['web.assets_common', 'web.assets_backend'] + TRACKED_BUNDLES = ['web.assets_backend'] def __init__(self, name, files, external_assets=(), env=None, css=True, js=True, debug_assets=False, rtl=False, assets_params=None): """