From 3e3dce0eb893a16d06b8c85a95bdc4bb24ea8a89 Mon Sep 17 00:00:00 2001 From: Julien Mougenot Date: Fri, 2 Apr 2021 11:54:09 +0000 Subject: [PATCH] [REF] *: rename assets 'glob' to 'path' Rationale: The majority of cases where an ir.asset is manually declared outside of manifest files is to specifically add a single asset file. This means developers are specifying a single asset *path*, and not a glob expression. In this context, it seems better to name the filepath field `path`, and document that it can be specified with a glob expression when (seldom) needed, rather than making the exception appear to be the norm - possibly puzzling many developers (What's a glob and why do I need one?) The doc is updated as well, and some spell-checking and wording improvements were done too. This required some adaptations to the existing `ir.asset` declarations: - odoo/enterprise#17465 - odoo/design-themes#459 closes odoo/odoo#68695 Related: odoo/upgrade#2348 Signed-off-by: Olivier Dony (odo) --- addons/web/tests/test_serving_base.py | 2 +- addons/web_editor/data/editor_assets.xml | 2 +- addons/web_editor/models/assets.py | 4 +- addons/website/data/ir_asset.xml | 8 +- addons/website/models/theme_models.py | 4 +- addons/website/tests/test_ui.py | 2 +- addons/website/views/snippets/s_alert.xml | 2 +- addons/website/views/snippets/s_badge.xml | 4 +- .../website/views/snippets/s_blockquote.xml | 2 +- addons/website/views/snippets/s_btn.xml | 2 +- addons/website/views/snippets/s_card.xml | 2 +- addons/website/views/snippets/s_chart.xml | 2 +- .../views/snippets/s_color_blocks_2.xml | 2 +- .../website/views/snippets/s_company_team.xml | 2 +- .../website/views/snippets/s_comparisons.xml | 2 +- addons/website/views/snippets/s_countdown.xml | 2 +- .../views/snippets/s_dynamic_snippet.xml | 4 +- .../snippets/s_dynamic_snippet_carousel.xml | 4 +- .../views/snippets/s_facebook_page.xml | 2 +- .../website/views/snippets/s_faq_collapse.xml | 2 +- .../views/snippets/s_features_grid.xml | 2 +- .../website/views/snippets/s_google_map.xml | 4 +- addons/website/views/snippets/s_hr.xml | 2 +- .../views/snippets/s_image_gallery.xml | 6 +- addons/website/views/snippets/s_map.xml | 2 +- .../views/snippets/s_masonry_block.xml | 6 +- .../website/views/snippets/s_media_list.xml | 4 +- addons/website/views/snippets/s_popup.xml | 6 +- .../views/snippets/s_process_steps.xml | 2 +- .../views/snippets/s_product_catalog.xml | 2 +- .../website/views/snippets/s_product_list.xml | 4 +- .../views/snippets/s_quotes_carousel.xml | 4 +- addons/website/views/snippets/s_rating.xml | 4 +- .../website/views/snippets/s_references.xml | 2 +- addons/website/views/snippets/s_share.xml | 4 +- addons/website/views/snippets/s_showcase.xml | 6 +- .../views/snippets/s_table_of_content.xml | 4 +- addons/website/views/snippets/s_tabs.xml | 2 +- .../views/snippets/s_text_highlight.xml | 2 +- .../views/snippets/s_three_columns.xml | 2 +- addons/website/views/snippets/s_timeline.xml | 2 +- addons/website/views/snippets/s_title.xml | 2 +- addons/website/views/website_templates.xml | 4 +- addons/website_blog/data/ir_asset.xml | 4 +- .../views/snippets/s_blog_posts.xml | 4 +- addons/website_form/data/ir_asset.xml | 2 +- .../views/snippets/s_website_form.xml | 6 +- .../views/snippets/s_channel.xml | 2 +- .../snippets/s_dynamic_snippet_products.xml | 2 +- .../views/snippets/s_products_searchbar.xml | 2 +- doc/reference/javascript_reference.rst | 90 ++++++++++--------- odoo/addons/base/models/ir_asset.py | 22 ++--- odoo/addons/base/views/ir_asset_views.xml | 4 +- .../test_assetsbundle/data/ir_asset.xml | 2 +- .../tests/test_assetsbundle.py | 86 +++++++++--------- 55 files changed, 183 insertions(+), 177 deletions(-) diff --git a/addons/web/tests/test_serving_base.py b/addons/web/tests/test_serving_base.py index 0b55d599cd1..3ea1505e3cf 100644 --- a/addons/web/tests/test_serving_base.py +++ b/addons/web/tests/test_serving_base.py @@ -111,7 +111,7 @@ class TestStaticInheritanceCommon(BaseCase): # Private methods def _get_module_names(self): - return ','.join([glob[1] for glob in self.asset_paths]) + return ','.join([asset_path[1] for asset_path in self.asset_paths]) def _set_patchers(self): def _patched_for_get_asset_paths(*args, **kwargs): diff --git a/addons/web_editor/data/editor_assets.xml b/addons/web_editor/data/editor_assets.xml index e22eff594ea..fb1034f2e45 100644 --- a/addons/web_editor/data/editor_assets.xml +++ b/addons/web_editor/data/editor_assets.xml @@ -4,7 +4,7 @@ 13 0 color system support primary variables SCSS web._assets_primary_variables - web_editor/static/src/scss/13_0_color_system_support_primary_variables.scss + web_editor/static/src/scss/13_0_color_system_support_primary_variables.scss diff --git a/addons/web_editor/models/assets.py b/addons/web_editor/models/assets.py index 17da5c08eb4..d3fe8d76c8b 100644 --- a/addons/web_editor/models/assets.py +++ b/addons/web_editor/models/assets.py @@ -185,7 +185,7 @@ class Assets(models.AbstractModel): # Create an asset with the new attachment IrAsset = self.env['ir.asset'] new_asset = { - 'glob': custom_url, + 'path': custom_url, 'target': url, 'directive': 'replace', **self._save_asset_hook(), @@ -229,7 +229,7 @@ class Assets(models.AbstractModel): ir.asset() """ url = custom_url[1:] if custom_url.startswith(('/', '\\')) else custom_url - return self.env['ir.asset'].search([('glob', 'like', url)]) + return self.env['ir.asset'].search([('path', 'like', url)]) def _save_asset_hook(self): """ diff --git a/addons/website/data/ir_asset.xml b/addons/website/data/ir_asset.xml index 0d401d3d202..1eb9e832840 100644 --- a/addons/website/data/ir_asset.xml +++ b/addons/website/data/ir_asset.xml @@ -6,28 +6,28 @@ User custom bootstrap overridden SCSS web._assets_frontend_helpers prepend - website/static/src/scss/user_custom_bootstrap_overridden.scss + website/static/src/scss/user_custom_bootstrap_overridden.scss User custom rules SCSS web.assets_frontend - website/static/src/scss/user_custom_rules.scss + website/static/src/scss/user_custom_rules.scss Bs3 for 12 0 SCSS web.assets_frontend - website/static/src/scss/compatibility/bs3_for_12_0.scss + website/static/src/scss/compatibility/bs3_for_12_0.scss website.configurator_tour website.assets_editor - website/static/src/js/tours/configurator_tour.js + website/static/src/js/tours/configurator_tour.js diff --git a/addons/website/models/theme_models.py b/addons/website/models/theme_models.py index cdb0535758e..59851bfdd2a 100644 --- a/addons/website/models/theme_models.py +++ b/addons/website/models/theme_models.py @@ -26,7 +26,7 @@ class ThemeAsset(models.Model): (REMOVE_DIRECTIVE, 'Remove'), (REPLACE_DIRECTIVE, 'Replace'), (INCLUDE_DIRECTIVE, 'Include')], default=APPEND_DIRECTIVE) - glob = fields.Char(required=True) + path = fields.Char(required=True) target = fields.Char() active = fields.Boolean(default=True) sequence = fields.Integer(default=DEFAULT_SEQUENCE, required=True) @@ -39,7 +39,7 @@ class ThemeAsset(models.Model): 'key': self.key, 'bundle': self.bundle, 'directive': self.directive, - 'glob': self.glob, + 'path': self.path, 'target': self.target, 'active': self.active, 'sequence': self.sequence, diff --git a/addons/website/tests/test_ui.py b/addons/website/tests/test_ui.py index 7bfefbf67f9..55ee86e3310 100644 --- a/addons/website/tests/test_ui.py +++ b/addons/website/tests/test_ui.py @@ -157,7 +157,7 @@ class TestUi(odoo.tests.HttpCase): self.env['ir.asset'].create({ 'name': 'EditorExtension', 'bundle': 'website.assets_wysiwyg', - 'glob': custom_url, + 'path': custom_url, 'website_id': new_website.id, }) diff --git a/addons/website/views/snippets/s_alert.xml b/addons/website/views/snippets/s_alert.xml index f94875e9d05..400977a4eaf 100644 --- a/addons/website/views/snippets/s_alert.xml +++ b/addons/website/views/snippets/s_alert.xml @@ -42,7 +42,7 @@ Alert 000 SCSS web.assets_frontend - website/static/src/snippets/s_alert/000.scss + website/static/src/snippets/s_alert/000.scss diff --git a/addons/website/views/snippets/s_badge.xml b/addons/website/views/snippets/s_badge.xml index ed57ad994a4..e4ae7580989 100644 --- a/addons/website/views/snippets/s_badge.xml +++ b/addons/website/views/snippets/s_badge.xml @@ -21,13 +21,13 @@ Badge 000 variables SCSS web._assets_primary_variables - website/static/src/snippets/s_badge/000_variables.scss + website/static/src/snippets/s_badge/000_variables.scss Badge 000 SCSS web.assets_frontend - website/static/src/snippets/s_badge/000.scss + website/static/src/snippets/s_badge/000.scss diff --git a/addons/website/views/snippets/s_blockquote.xml b/addons/website/views/snippets/s_blockquote.xml index dd5c02a4ab5..75eb66d2cff 100644 --- a/addons/website/views/snippets/s_blockquote.xml +++ b/addons/website/views/snippets/s_blockquote.xml @@ -53,7 +53,7 @@ Blockquote 000 SCSS web.assets_frontend - website/static/src/snippets/s_blockquote/000.scss + website/static/src/snippets/s_blockquote/000.scss diff --git a/addons/website/views/snippets/s_btn.xml b/addons/website/views/snippets/s_btn.xml index 1895899ffca..0f46e5a6855 100644 --- a/addons/website/views/snippets/s_btn.xml +++ b/addons/website/views/snippets/s_btn.xml @@ -4,7 +4,7 @@ Btn 000 SCSS web.assets_frontend - website/static/src/snippets/s_btn/000.scss + website/static/src/snippets/s_btn/000.scss diff --git a/addons/website/views/snippets/s_card.xml b/addons/website/views/snippets/s_card.xml index cdccfc9b09e..9325dac2abd 100644 --- a/addons/website/views/snippets/s_card.xml +++ b/addons/website/views/snippets/s_card.xml @@ -16,7 +16,7 @@ Card 000 SCSS web.assets_frontend - website/static/src/snippets/s_card/000.scss + website/static/src/snippets/s_card/000.scss diff --git a/addons/website/views/snippets/s_chart.xml b/addons/website/views/snippets/s_chart.xml index 2078c2a9b27..c276607e5be 100644 --- a/addons/website/views/snippets/s_chart.xml +++ b/addons/website/views/snippets/s_chart.xml @@ -69,7 +69,7 @@ Chart 000 JS web.assets_frontend - website/static/src/snippets/s_chart/000.js + website/static/src/snippets/s_chart/000.js diff --git a/addons/website/views/snippets/s_color_blocks_2.xml b/addons/website/views/snippets/s_color_blocks_2.xml index 76ae8babbbf..cb8ef1e9b3e 100644 --- a/addons/website/views/snippets/s_color_blocks_2.xml +++ b/addons/website/views/snippets/s_color_blocks_2.xml @@ -25,7 +25,7 @@ Color blocks 2 000 SCSS web.assets_frontend - website/static/src/snippets/s_color_blocks_2/000.scss + website/static/src/snippets/s_color_blocks_2/000.scss diff --git a/addons/website/views/snippets/s_company_team.xml b/addons/website/views/snippets/s_company_team.xml index 2e58d0b7a25..04cb3e56fd1 100644 --- a/addons/website/views/snippets/s_company_team.xml +++ b/addons/website/views/snippets/s_company_team.xml @@ -61,7 +61,7 @@ Company team 000 SCSS web.assets_frontend - website/static/src/snippets/s_company_team/000.scss + website/static/src/snippets/s_company_team/000.scss diff --git a/addons/website/views/snippets/s_comparisons.xml b/addons/website/views/snippets/s_comparisons.xml index 0114f6160ab..02b9bb54b2f 100644 --- a/addons/website/views/snippets/s_comparisons.xml +++ b/addons/website/views/snippets/s_comparisons.xml @@ -82,7 +82,7 @@ Comparisons 000 SCSS web.assets_frontend - website/static/src/snippets/s_comparisons/000.scss + website/static/src/snippets/s_comparisons/000.scss diff --git a/addons/website/views/snippets/s_countdown.xml b/addons/website/views/snippets/s_countdown.xml index 3c35d11763b..e4e2d0f3c4e 100644 --- a/addons/website/views/snippets/s_countdown.xml +++ b/addons/website/views/snippets/s_countdown.xml @@ -70,7 +70,7 @@ Countdown 000 JS web.assets_frontend - website/static/src/snippets/s_countdown/000.js + website/static/src/snippets/s_countdown/000.js diff --git a/addons/website/views/snippets/s_dynamic_snippet.xml b/addons/website/views/snippets/s_dynamic_snippet.xml index 4560c522849..bd7d45de56f 100644 --- a/addons/website/views/snippets/s_dynamic_snippet.xml +++ b/addons/website/views/snippets/s_dynamic_snippet.xml @@ -55,13 +55,13 @@ Dynamic snippet 000 SCSS web.assets_frontend - website/static/src/snippets/s_dynamic_snippet/000.scss + website/static/src/snippets/s_dynamic_snippet/000.scss Dynamic snippet 000 JS web.assets_frontend - website/static/src/snippets/s_dynamic_snippet/000.js + website/static/src/snippets/s_dynamic_snippet/000.js diff --git a/addons/website/views/snippets/s_dynamic_snippet_carousel.xml b/addons/website/views/snippets/s_dynamic_snippet_carousel.xml index b9e5ad0f8d6..bd0950424a0 100644 --- a/addons/website/views/snippets/s_dynamic_snippet_carousel.xml +++ b/addons/website/views/snippets/s_dynamic_snippet_carousel.xml @@ -28,13 +28,13 @@ Dynamic snippet carousel 000 SCSS web.assets_frontend - website/static/src/snippets/s_dynamic_snippet_carousel/000.scss + website/static/src/snippets/s_dynamic_snippet_carousel/000.scss Dynamic snippet carousel 000 JS web.assets_frontend - website/static/src/snippets/s_dynamic_snippet_carousel/000.js + website/static/src/snippets/s_dynamic_snippet_carousel/000.js diff --git a/addons/website/views/snippets/s_facebook_page.xml b/addons/website/views/snippets/s_facebook_page.xml index 30572e046b5..3d0f978824a 100644 --- a/addons/website/views/snippets/s_facebook_page.xml +++ b/addons/website/views/snippets/s_facebook_page.xml @@ -25,7 +25,7 @@ Facebook page 000 JS web.assets_frontend - website/static/src/snippets/s_facebook_page/000.js + website/static/src/snippets/s_facebook_page/000.js diff --git a/addons/website/views/snippets/s_faq_collapse.xml b/addons/website/views/snippets/s_faq_collapse.xml index a742d34afab..6c89862655f 100644 --- a/addons/website/views/snippets/s_faq_collapse.xml +++ b/addons/website/views/snippets/s_faq_collapse.xml @@ -38,7 +38,7 @@ Faq collapse 000 SCSS web.assets_frontend - website/static/src/snippets/s_faq_collapse/000.scss + website/static/src/snippets/s_faq_collapse/000.scss diff --git a/addons/website/views/snippets/s_features_grid.xml b/addons/website/views/snippets/s_features_grid.xml index cebd940323a..7e8b46a182a 100644 --- a/addons/website/views/snippets/s_features_grid.xml +++ b/addons/website/views/snippets/s_features_grid.xml @@ -71,7 +71,7 @@ Features grid 000 SCSS web.assets_frontend - website/static/src/snippets/s_features_grid/000.scss + website/static/src/snippets/s_features_grid/000.scss diff --git a/addons/website/views/snippets/s_google_map.xml b/addons/website/views/snippets/s_google_map.xml index 82c039ab5ce..07974bfc653 100644 --- a/addons/website/views/snippets/s_google_map.xml +++ b/addons/website/views/snippets/s_google_map.xml @@ -47,13 +47,13 @@ Google map 000 SCSS web.assets_frontend - website/static/src/snippets/s_google_map/000.scss + website/static/src/snippets/s_google_map/000.scss Google map 000 JS web.assets_frontend - website/static/src/snippets/s_google_map/000.js + website/static/src/snippets/s_google_map/000.js diff --git a/addons/website/views/snippets/s_hr.xml b/addons/website/views/snippets/s_hr.xml index 8a0ba36e1d2..adaac74fd41 100644 --- a/addons/website/views/snippets/s_hr.xml +++ b/addons/website/views/snippets/s_hr.xml @@ -32,7 +32,7 @@ Hr 000 SCSS web.assets_frontend - website/static/src/snippets/s_hr/000.scss + website/static/src/snippets/s_hr/000.scss diff --git a/addons/website/views/snippets/s_image_gallery.xml b/addons/website/views/snippets/s_image_gallery.xml index 5ecb513350b..e2e36c12851 100644 --- a/addons/website/views/snippets/s_image_gallery.xml +++ b/addons/website/views/snippets/s_image_gallery.xml @@ -133,20 +133,20 @@ Image gallery 000 JS web.assets_frontend - website/static/src/snippets/s_image_gallery/000.js + website/static/src/snippets/s_image_gallery/000.js Image gallery 000 SCSS web.assets_frontend - website/static/src/snippets/s_image_gallery/000.scss + website/static/src/snippets/s_image_gallery/000.scss Image gallery 001 SCSS web.assets_frontend - website/static/src/snippets/s_image_gallery/001.scss + website/static/src/snippets/s_image_gallery/001.scss diff --git a/addons/website/views/snippets/s_map.xml b/addons/website/views/snippets/s_map.xml index 8801e62d5c6..35c192cbf6e 100644 --- a/addons/website/views/snippets/s_map.xml +++ b/addons/website/views/snippets/s_map.xml @@ -63,7 +63,7 @@ Map 000 SCSS web.assets_frontend - website/static/src/snippets/s_map/000.scss + website/static/src/snippets/s_map/000.scss diff --git a/addons/website/views/snippets/s_masonry_block.xml b/addons/website/views/snippets/s_masonry_block.xml index b3835076af8..acf0afc3a83 100644 --- a/addons/website/views/snippets/s_masonry_block.xml +++ b/addons/website/views/snippets/s_masonry_block.xml @@ -38,20 +38,20 @@ Masonry block 000 SCSS web.assets_frontend - website/static/src/snippets/s_masonry_block/000.scss + website/static/src/snippets/s_masonry_block/000.scss Masonry block 001 SCSS web.assets_frontend - website/static/src/snippets/s_masonry_block/001.scss + website/static/src/snippets/s_masonry_block/001.scss Masonry block 000 variables SCSS web._assets_primary_variables - website/static/src/snippets/s_masonry_block/000_variables.scss + website/static/src/snippets/s_masonry_block/000_variables.scss diff --git a/addons/website/views/snippets/s_media_list.xml b/addons/website/views/snippets/s_media_list.xml index 1671e83cf5f..95ee6590e95 100644 --- a/addons/website/views/snippets/s_media_list.xml +++ b/addons/website/views/snippets/s_media_list.xml @@ -97,14 +97,14 @@ Media list 000 SCSS web.assets_frontend - website/static/src/snippets/s_media_list/000.scss + website/static/src/snippets/s_media_list/000.scss Media list 001 SCSS web.assets_frontend - website/static/src/snippets/s_media_list/001.scss + website/static/src/snippets/s_media_list/001.scss diff --git a/addons/website/views/snippets/s_popup.xml b/addons/website/views/snippets/s_popup.xml index 4c95af541a8..104b0f4b93a 100644 --- a/addons/website/views/snippets/s_popup.xml +++ b/addons/website/views/snippets/s_popup.xml @@ -71,20 +71,20 @@ Popup 000 SCSS web.assets_frontend - website/static/src/snippets/s_popup/000.scss + website/static/src/snippets/s_popup/000.scss Popup 000 JS web.assets_frontend - website/static/src/snippets/s_popup/000.js + website/static/src/snippets/s_popup/000.js Popup 001 SCSS web.assets_frontend - website/static/src/snippets/s_popup/001.scss + website/static/src/snippets/s_popup/001.scss diff --git a/addons/website/views/snippets/s_process_steps.xml b/addons/website/views/snippets/s_process_steps.xml index 674f7937592..c0690367c05 100644 --- a/addons/website/views/snippets/s_process_steps.xml +++ b/addons/website/views/snippets/s_process_steps.xml @@ -57,7 +57,7 @@ Process steps 000 SCSS web.assets_frontend - website/static/src/snippets/s_process_steps/000.scss + website/static/src/snippets/s_process_steps/000.scss diff --git a/addons/website/views/snippets/s_product_catalog.xml b/addons/website/views/snippets/s_product_catalog.xml index 8246427e290..f1d0e64a29a 100644 --- a/addons/website/views/snippets/s_product_catalog.xml +++ b/addons/website/views/snippets/s_product_catalog.xml @@ -77,7 +77,7 @@ Product catalog 001 SCSS web.assets_frontend - website/static/src/snippets/s_product_catalog/001.scss + website/static/src/snippets/s_product_catalog/001.scss diff --git a/addons/website/views/snippets/s_product_list.xml b/addons/website/views/snippets/s_product_list.xml index e85a955c282..f39bcc3fe81 100644 --- a/addons/website/views/snippets/s_product_list.xml +++ b/addons/website/views/snippets/s_product_list.xml @@ -61,13 +61,13 @@ Product list 000 variables SCSS web._assets_primary_variables - website/static/src/snippets/s_product_list/000_variables.scss + website/static/src/snippets/s_product_list/000_variables.scss Product list 000 SCSS web.assets_frontend - website/static/src/snippets/s_product_list/000.scss + website/static/src/snippets/s_product_list/000.scss diff --git a/addons/website/views/snippets/s_quotes_carousel.xml b/addons/website/views/snippets/s_quotes_carousel.xml index 56453428fdd..303f30894f0 100644 --- a/addons/website/views/snippets/s_quotes_carousel.xml +++ b/addons/website/views/snippets/s_quotes_carousel.xml @@ -74,14 +74,14 @@ Quotes carousel 000 SCSS web.assets_frontend - website/static/src/snippets/s_quotes_carousel/000.scss + website/static/src/snippets/s_quotes_carousel/000.scss Quotes carousel 001 SCSS web.assets_frontend - website/static/src/snippets/s_quotes_carousel/001.scss + website/static/src/snippets/s_quotes_carousel/001.scss diff --git a/addons/website/views/snippets/s_rating.xml b/addons/website/views/snippets/s_rating.xml index 51621b558aa..30bf0a45d63 100644 --- a/addons/website/views/snippets/s_rating.xml +++ b/addons/website/views/snippets/s_rating.xml @@ -59,14 +59,14 @@ Rating 000 SCSS web.assets_frontend - website/static/src/snippets/s_rating/000.scss + website/static/src/snippets/s_rating/000.scss Rating 001 SCSS web.assets_frontend - website/static/src/snippets/s_rating/001.scss + website/static/src/snippets/s_rating/001.scss diff --git a/addons/website/views/snippets/s_references.xml b/addons/website/views/snippets/s_references.xml index 22dcfadf000..2175a7f8e2b 100644 --- a/addons/website/views/snippets/s_references.xml +++ b/addons/website/views/snippets/s_references.xml @@ -33,7 +33,7 @@ References 000 SCSS web.assets_frontend - website/static/src/snippets/s_references/000.scss + website/static/src/snippets/s_references/000.scss diff --git a/addons/website/views/snippets/s_share.xml b/addons/website/views/snippets/s_share.xml index 28be8d079f1..8c853f88491 100644 --- a/addons/website/views/snippets/s_share.xml +++ b/addons/website/views/snippets/s_share.xml @@ -53,13 +53,13 @@ Share 000 SCSS web.assets_frontend - website/static/src/snippets/s_share/000.scss + website/static/src/snippets/s_share/000.scss Share 000 JS web.assets_frontend - website/static/src/snippets/s_share/000.js + website/static/src/snippets/s_share/000.js diff --git a/addons/website/views/snippets/s_showcase.xml b/addons/website/views/snippets/s_showcase.xml index da5506ea23b..b0052a184e6 100644 --- a/addons/website/views/snippets/s_showcase.xml +++ b/addons/website/views/snippets/s_showcase.xml @@ -65,21 +65,21 @@ Showcase 000 SCSS web.assets_frontend - website/static/src/snippets/s_showcase/000.scss + website/static/src/snippets/s_showcase/000.scss Showcase 001 SCSS web.assets_frontend - website/static/src/snippets/s_showcase/001.scss + website/static/src/snippets/s_showcase/001.scss Showcase 002 SCSS web.assets_frontend - website/static/src/snippets/s_showcase/002.scss + website/static/src/snippets/s_showcase/002.scss diff --git a/addons/website/views/snippets/s_table_of_content.xml b/addons/website/views/snippets/s_table_of_content.xml index 356ff164f28..3bb88175077 100644 --- a/addons/website/views/snippets/s_table_of_content.xml +++ b/addons/website/views/snippets/s_table_of_content.xml @@ -64,13 +64,13 @@ Table of content 000 SCSS web.assets_frontend - website/static/src/snippets/s_table_of_content/000.scss + website/static/src/snippets/s_table_of_content/000.scss Table of content 000 JS web.assets_frontend - website/static/src/snippets/s_table_of_content/000.js + website/static/src/snippets/s_table_of_content/000.js diff --git a/addons/website/views/snippets/s_tabs.xml b/addons/website/views/snippets/s_tabs.xml index 1b094f054a8..d42cffef4ad 100644 --- a/addons/website/views/snippets/s_tabs.xml +++ b/addons/website/views/snippets/s_tabs.xml @@ -79,7 +79,7 @@ Tabs 001 SCSS web.assets_frontend - website/static/src/snippets/s_tabs/001.scss + website/static/src/snippets/s_tabs/001.scss diff --git a/addons/website/views/snippets/s_text_highlight.xml b/addons/website/views/snippets/s_text_highlight.xml index 37ace1a8520..c5c0c176daf 100644 --- a/addons/website/views/snippets/s_text_highlight.xml +++ b/addons/website/views/snippets/s_text_highlight.xml @@ -13,7 +13,7 @@ Text highlight 000 SCSS web.assets_frontend - website/static/src/snippets/s_text_highlight/000.scss + website/static/src/snippets/s_text_highlight/000.scss diff --git a/addons/website/views/snippets/s_three_columns.xml b/addons/website/views/snippets/s_three_columns.xml index 040ae99a519..ccc14c68524 100644 --- a/addons/website/views/snippets/s_three_columns.xml +++ b/addons/website/views/snippets/s_three_columns.xml @@ -40,7 +40,7 @@ Three columns 000 SCSS web.assets_frontend - website/static/src/snippets/s_three_columns/000.scss + website/static/src/snippets/s_three_columns/000.scss diff --git a/addons/website/views/snippets/s_timeline.xml b/addons/website/views/snippets/s_timeline.xml index 3c2cc737c66..9ca5212d8b6 100644 --- a/addons/website/views/snippets/s_timeline.xml +++ b/addons/website/views/snippets/s_timeline.xml @@ -67,7 +67,7 @@ Timeline 000 SCSS web.assets_frontend - website/static/src/snippets/s_timeline/000.scss + website/static/src/snippets/s_timeline/000.scss diff --git a/addons/website/views/snippets/s_title.xml b/addons/website/views/snippets/s_title.xml index 4b02561003c..61eaebab92e 100644 --- a/addons/website/views/snippets/s_title.xml +++ b/addons/website/views/snippets/s_title.xml @@ -12,7 +12,7 @@ Title 000 SCSS web.assets_frontend - website/static/src/snippets/s_title/000.scss + website/static/src/snippets/s_title/000.scss diff --git a/addons/website/views/website_templates.xml b/addons/website/views/website_templates.xml index 95f6eaac7ae..fc7924ea6bd 100644 --- a/addons/website/views/website_templates.xml +++ b/addons/website/views/website_templates.xml @@ -1968,14 +1968,14 @@ Ripple effect SCSS web.assets_frontend - /website/static/src/scss/options/ripple_effect.scss + /website/static/src/scss/options/ripple_effect.scss Ripple effect JS web.assets_frontend - /website/static/src/js/content/ripple_effect.js + /website/static/src/js/content/ripple_effect.js diff --git a/addons/website_blog/data/ir_asset.xml b/addons/website_blog/data/ir_asset.xml index 67e3aff1303..591eea28cd5 100644 --- a/addons/website_blog/data/ir_asset.xml +++ b/addons/website_blog/data/ir_asset.xml @@ -1,11 +1,11 @@ - + Latest posts 000 SCSS web.assets_frontend - website_blog/static/src/snippets/s_latest_posts/000.scss + website_blog/static/src/snippets/s_latest_posts/000.scss diff --git a/addons/website_blog/views/snippets/s_blog_posts.xml b/addons/website_blog/views/snippets/s_blog_posts.xml index 0722cfc8d06..5da8cb7e85e 100644 --- a/addons/website_blog/views/snippets/s_blog_posts.xml +++ b/addons/website_blog/views/snippets/s_blog_posts.xml @@ -135,13 +135,13 @@ Blog posts 000 SCSS web.assets_frontend - website_blog/static/src/snippets/s_blog_posts/000.scss + website_blog/static/src/snippets/s_blog_posts/000.scss Blog posts 000 JS web.assets_frontend - website_blog/static/src/snippets/s_blog_posts/000.js + website_blog/static/src/snippets/s_blog_posts/000.js diff --git a/addons/website_form/data/ir_asset.xml b/addons/website_form/data/ir_asset.xml index 986da8e9c5f..743abe7b91f 100644 --- a/addons/website_form/data/ir_asset.xml +++ b/addons/website_form/data/ir_asset.xml @@ -5,7 +5,7 @@ Website form 000 SCSS web.assets_frontend - website_form/static/src/snippets/s_website_form/000.scss + website_form/static/src/snippets/s_website_form/000.scss diff --git a/addons/website_form/views/snippets/s_website_form.xml b/addons/website_form/views/snippets/s_website_form.xml index b94d882a172..2670991be12 100644 --- a/addons/website_form/views/snippets/s_website_form.xml +++ b/addons/website_form/views/snippets/s_website_form.xml @@ -161,20 +161,20 @@ Website form 000 SCSS web.assets_frontend - website_form/static/src/snippets/s_website_form/000.scss + website_form/static/src/snippets/s_website_form/000.scss Website form 001 SCSS web.assets_frontend - website_form/static/src/snippets/s_website_form/001.scss + website_form/static/src/snippets/s_website_form/001.scss Website form 000 JS web.assets_frontend - website_form/static/src/snippets/s_website_form/000.js + website_form/static/src/snippets/s_website_form/000.js diff --git a/addons/website_mail_channel/views/snippets/s_channel.xml b/addons/website_mail_channel/views/snippets/s_channel.xml index 171a5af755d..13d6d8723ec 100644 --- a/addons/website_mail_channel/views/snippets/s_channel.xml +++ b/addons/website_mail_channel/views/snippets/s_channel.xml @@ -41,7 +41,7 @@ Channel 000 JS web.assets_frontend - website_mail_channel/static/src/snippets/s_channel/000.js + website_mail_channel/static/src/snippets/s_channel/000.js diff --git a/addons/website_sale/views/snippets/s_dynamic_snippet_products.xml b/addons/website_sale/views/snippets/s_dynamic_snippet_products.xml index c8156714804..60d593c6cfb 100644 --- a/addons/website_sale/views/snippets/s_dynamic_snippet_products.xml +++ b/addons/website_sale/views/snippets/s_dynamic_snippet_products.xml @@ -30,7 +30,7 @@ Dynamic snippet products 000 JS web.assets_frontend - website_sale/static/src/snippets/s_dynamic_snippet_products/000.js + website_sale/static/src/snippets/s_dynamic_snippet_products/000.js diff --git a/addons/website_sale/views/snippets/s_products_searchbar.xml b/addons/website_sale/views/snippets/s_products_searchbar.xml index 1babca1062c..0734ace5f45 100644 --- a/addons/website_sale/views/snippets/s_products_searchbar.xml +++ b/addons/website_sale/views/snippets/s_products_searchbar.xml @@ -48,7 +48,7 @@ Products searchbar 000 JS web.assets_frontend - website_sale/static/src/snippets/s_products_searchbar/000.js + website_sale/static/src/snippets/s_products_searchbar/000.js diff --git a/doc/reference/javascript_reference.rst b/doc/reference/javascript_reference.rst index 796ac7c6656..e89abd680f7 100644 --- a/doc/reference/javascript_reference.rst +++ b/doc/reference/javascript_reference.rst @@ -80,21 +80,21 @@ Assets Management ================= Managing assets in Odoo is not as straightforward as it is in some other apps. -One of the reason is that we have a variety of situations where some, but not all -the assets are required. For example, the needs of the web client, the point of -sale, the website or even the mobile application are different. Also, some +One of the reasons is that we have a variety of situations where some, but not all +of the assets are required. For example, the needs of the web client, the point of +sale app, the website or even the mobile application are different. Also, some assets may be large, but are seldom needed. In that case, we sometimes want them to be loaded lazily. The main idea is that we define a set of **bundles** in the module manifest. A bundle is here defined as a **list of file paths** (xml, javascript, css, scss). Files are declared using `glob`_ syntax, meaning that you can declare several asset -files using a single line. Each file found using a glob will be appended to the -`` of the page, at most once, in the order the globs are given. +files using a single line. Each matching file found will be appended to the +`` of the page, at most once, in the order the glob patterns are given. -As mentionned, the bundles are declared in each module's `__manifest__.py`, under -a dedicated `assets` key which contains a dictionary. Said dictionary will declare -**bundles** (keys) with the **files** they contain (values). It looks like this: +As mentioned, the bundles are declared in each module's `__manifest__.py`, under +a dedicated `assets` key which contains a dictionary. The dictionary will map +**bundles** (keys) to the list of **files** they contain (values). It looks like this: .. code-block:: py @@ -173,7 +173,7 @@ be covered with the following operations. a) Add one or multiple file(s): `append` The proper way to add a file to a bundle in any addon is simple: it is just enough - to add a glob path to the bundle in the file `__manifest__.py` like so: + to add a glob pattern to the bundle in the file `__manifest__.py` like so: .. code-block:: py @@ -182,11 +182,13 @@ a) Add one or multiple file(s): `append` ], By default, adding a simple string to a bundle will append the files matching the - glob at the end of the bundle. + glob pattern at the end of the bundle. Obviously, the pattern may also be directly + a single file path. b) Add one or multiple file(s) at the beginning of the list: `prepend` Sometimes you need to put a certain file before the others in a bundle, when - loading css file for example. In this case, you can use the `prepend` directive + loading css file, for example. In this case, you can use the `prepend` directive + by replacing the path with a pair `('prepend', )`, like so: .. code-block:: py @@ -197,8 +199,9 @@ b) Add one or multiple file(s) at the beginning of the list: `prepend` c) Add one or multiple file(s) before a specific file: `before` Prepending a file at the beginning of a bundle might not be precise enough. The - `before` directive can be used to add the given files right before the target - file. + `before` directive can be used to add the given file(s) right *before* the target + file. It is declared by replacing the normal path with a 3-element tuple + `('before', , )`, like so: .. code-block:: py @@ -206,8 +209,10 @@ c) Add one or multiple file(s) before a specific file: `before` ('before', 'web/static/src/css/bootstrap_overridden.scss', 'my_addon/static/src/css/bootstrap_overridden.scss'), ], -d) Add one or multiple file(s) after a specofic file: `after` - Same as `before`, with the resulting files appended after the target file. +d) Add one or multiple file(s) after a specific file: `after` + Same as `before`, with the matching file(s) appended right *after* the target file. + It is declared by replacing the normal path with a 3-element tuple + `('after', , )`, like so: .. code-block:: py @@ -218,8 +223,8 @@ d) Add one or multiple file(s) after a specofic file: `after` e) Use nested bundles: `include` The `include` directive is a way to use a same bundle in other bundles to minimize the size of your manifest. In Odoo we use sub bundles (prefixed with an underscore - by convention) to batch glob files used in multiple other bundles. You can then - specify the sub bundle like this: + by convention) to batch files used in multiple other bundles. You can then + specify the sub bundle as a pair `('include', )` like this: .. code-block:: py @@ -230,7 +235,7 @@ e) Use nested bundles: `include` f) Remove one or multiple file(s): `remove` In some additional module you may want to get rid of the call of a certain asset in a bundle. Any file can be removed from an existing bundle using the `remove` - directive: + directive by specifying a pair `('remove', )`: .. code-block:: py @@ -241,7 +246,7 @@ f) Remove one or multiple file(s): `remove` g) Replace an asset file with one or multiple file(s): `replace` Let us now say that an asset need not only to be removed, but you also want to insert your new version of that asset at the same exact position. This can be done with - the `replace` directive, using a 3-element tuple: + the `replace` directive, using a 3-element tuple `('replace', , )`: .. code-block:: py @@ -249,7 +254,7 @@ g) Replace an asset file with one or multiple file(s): `replace` ('replace', 'web/static/src/js/boot.js', 'my_addon/static/src/js/boot.js'), ], - Note that directives targetting a certain file (i.e. `before`, `after`, + Note that all directives targeting a certain asset file (i.e. `before`, `after`, `replace` and `remove`) need that file to be declared beforehand, either in manifests higher up in the hierarchy or in ``ir.asset`` records with a lower sequence. @@ -262,7 +267,7 @@ g) Replace an asset file with one or multiple file(s): `replace` better to lazyload some assets. For example, if a widget requires a large library, and that widget is not a core part of the experience, then it may be a good idea to only load the library when the widget is actually created. The - widget class has actually builtin support just for this use case. (see section + widget class has actually built-in support just for this use case. (see section :ref:`reference/javascript_reference/qweb`) Assets loading order @@ -286,7 +291,7 @@ a file already present in the list, nothing is done for that file. In other word only the first occurrence of a file is kept in the list. 4. The remaining ``ir.asset`` records (those with a sequence greater than or equal -to 16) are eventually processed and applied as well. +to 16) are then processed and applied as well. Assets declared in the manifest may need to be loaded in a particular order, for example `jquery.js` must be loaded before all other jquery scripts when loading the @@ -313,11 +318,12 @@ in the list before all the others included in the glob. The asset model (``ir.asset``) ------------------------------ -In most cases the assets declared in the manifest will largely suffice. But Odoo -being highly customizable requires to modify things as critical as defining assets -to be editted in place. A model ``ir.asset`` exists to do such things. Records will -be associated to a `bundle` and apply their `glob` (and `target` if any) to the -list of assets using according to their `directive`. +In most cases the assets declared in the manifest will largely suffice. Yet for +more flexibility, the framework also supports dynamic assets declared in the +database. +This is done by creating ``ir.asset`` records. Those will be processed as if they +were found in a module manifest, and they give the same expressive power as their +manifest counterparts. .. autoclass:: odoo.addons.base.models.ir_asset.IrAsset @@ -328,24 +334,24 @@ list of assets using according to their `directive`. Bundle in which the asset will be applied. ``directive`` (default= `append`) - This field determines how the `glob` (and `target` if needed) will be interpreted. + This field determines how the `path` (and `target` if needed) will be interpreted. Here is the list of available directives along with their required arguments: - - **append**: `glob` - - **prepend**: `glob` - - **before**: `target`, `glob` - - **after**: `target`, `glob` - - **include**: `glob` (interpreted as a **bundle name**) - - **remove**: `target` - - **replace**: `target`, `glob` + - **append**: `path` + - **prepend**: `path` + - **before**: `target`, `path` + - **after**: `target`, `path` + - **include**: `path` (interpreted as a **bundle name**) + - **remove**: `path` (interpreted as a **target asset** to remove) + - **replace**: `target`, `path` -``glob`` - Glob string defining one of the following: +``path`` + A string defining one of the following: - - a **glob path** to a set of files in the Odoo file system; - - a **relative path** to a file in the Odoo file system; - - an **URL** to an attachment/external source; - - a **bundle name** if using the `include` directive. + - a **relative path** to an asset file in the addons file system; + - a **glob pattern** to a set of asset files in the addons file system; + - a **URL** to an attachment or external asset file; + - a **bundle name**, when using the `include` directive. ``target`` Target file to specify a position in the bundle. Can only be used with the @@ -368,7 +374,7 @@ are a few things you can try to solve the issue: modified. So, you can simply restart the server to regenerate the assets. - check the console (in the dev tools, usually opened with F12) to make sure there are no obvious errors -- try to add a console.log at the beginning of your file (before any module +- try to add a `console.log()` at the beginning of your file (before any module definition), so you can see if a file has been loaded or not - when in any debug mode, there is an option in the debug manager menu (bug icon) to force the server to update its assets files. diff --git a/odoo/addons/base/models/ir_asset.py b/odoo/addons/base/models/ir_asset.py index 51a1c412703..d4eeed22437 100644 --- a/odoo/addons/base/models/ir_asset.py +++ b/odoo/addons/base/models/ir_asset.py @@ -83,7 +83,7 @@ class IrAsset(models.Model): (REMOVE_DIRECTIVE, 'Remove'), (REPLACE_DIRECTIVE, 'Replace'), (INCLUDE_DIRECTIVE, 'Include')], default=APPEND_DIRECTIVE) - glob = fields.Char(string='Path', required=True) + path = fields.Char(string='Path (or glob pattern)', required=True) target = fields.Char(string='Target') active = fields.Boolean(string='active', default=True) sequence = fields.Integer(string="Sequence", default=DEFAULT_SEQUENCE, required=True) @@ -200,7 +200,7 @@ class IrAsset(models.Model): # 1. Process the first sequence of 'ir.asset' records assets = self._get_related_assets([('bundle', '=', bundle)]).filtered('active') for asset in assets.filtered(lambda a: a.sequence < DEFAULT_SEQUENCE): - process_path(asset.directive, asset.target, asset.glob) + process_path(asset.directive, asset.target, asset.path) # 2. Process all addons' manifests. for addon in self._topological_sort(tuple(addons)): @@ -221,7 +221,7 @@ class IrAsset(models.Model): # 3. Process the rest of 'ir.asset' records for asset in assets.filtered(lambda a: a.sequence >= DEFAULT_SEQUENCE): - process_path(asset.directive, asset.target, asset.glob) + process_path(asset.directive, asset.target, asset.path) def _get_related_assets(self, domain): """ @@ -301,15 +301,15 @@ class IrAsset(models.Model): def _get_paths(self, path_def, installed, extensions=None): """ Returns a list of file paths matching a given glob (path_def) as well as - the addon targetted by the path definition. If no file matches that glob, - the path definition is returned as is. This is either because the glob is - not correctly written or because it points to an URL. + the addon targeted by the path definition. If no file matches that glob, + the path definition is returned as is. This is either because the path is + not correctly written or because it points to a URL. :param path_def: the definition (glob) of file paths to match :param installed: the list of installed addons :param extensions: a list of extensions that found files must match - :returns: a tuple: the addon targetted by the path definition [0] and the - list of glob files matching the definition [1] (or the glob itself if + :returns: a tuple: the addon targeted by the path definition [0] and the + list of file paths matching the definition [1] (or the glob itself if none). Note that these paths are filtered on the given `extensions`. """ paths = [] @@ -410,7 +410,7 @@ class AssetPaths: self.memo.add(path) self.list[index:index] = to_insert - def remove(self, paths, addon, bundle, glob=None): + def remove(self, paths, addon, bundle, path=None): """Removes the given paths from the current list.""" paths = {path for path in paths if path in self.memo} if paths: @@ -418,8 +418,8 @@ class AssetPaths: self.memo.difference_update(paths) return - if glob: - self._raise_not_found(glob, bundle) + if path: + self._raise_not_found(path, bundle) def _raise_not_found(self, path, bundle): raise ValueError("File %s not found in bundle %s" % (path, bundle)) diff --git a/odoo/addons/base/views/ir_asset_views.xml b/odoo/addons/base/views/ir_asset_views.xml index 673fd7eb6c1..6794b963a35 100644 --- a/odoo/addons/base/views/ir_asset_views.xml +++ b/odoo/addons/base/views/ir_asset_views.xml @@ -15,7 +15,7 @@ - + @@ -43,7 +43,7 @@ - + diff --git a/odoo/addons/test_assetsbundle/data/ir_asset.xml b/odoo/addons/test_assetsbundle/data/ir_asset.xml index 5b6840ddf7e..88011f6939d 100644 --- a/odoo/addons/test_assetsbundle/data/ir_asset.xml +++ b/odoo/addons/test_assetsbundle/data/ir_asset.xml @@ -4,7 +4,7 @@ Test jsfile[!4] JS test_assetsbundle.bundle1 - test_assetsbundle/static/src/js/test_jsfile[!4].js + test_assetsbundle/static/src/js/test_jsfile[!4].js diff --git a/odoo/addons/test_assetsbundle/tests/test_assetsbundle.py b/odoo/addons/test_assetsbundle/tests/test_assetsbundle.py index ac6d7f30692..4b2d23eac06 100644 --- a/odoo/addons/test_assetsbundle/tests/test_assetsbundle.py +++ b/odoo/addons/test_assetsbundle/tests/test_assetsbundle.py @@ -251,7 +251,7 @@ class TestJavascriptAssetsBundle(FileTouchable): self.env['ir.asset'].create({ 'name': 'test bundle inheritance', 'bundle': self.jsbundle_name, - 'glob': 'test_assetsbundle/static/src/js/test_jsfile4.js', + 'path': 'test_assetsbundle/static/src/js/test_jsfile4.js', }) bundle1 = self._get_asset(self.jsbundle_name) @@ -370,7 +370,7 @@ class TestJavascriptAssetsBundle(FileTouchable): self.env['ir.asset'].create({ 'name': 'test bundle inheritance', 'bundle': self.cssbundle_name, - 'glob': 'test_assetsbundle/static/src/css/test_cssfile2.css', + 'path': 'test_assetsbundle/static/src/css/test_cssfile2.css', }) bundle1 = self._get_asset(self.cssbundle_name) @@ -562,7 +562,7 @@ class TestJavascriptAssetsBundle(FileTouchable): self.env['ir.asset'].create({ 'name': 'test bundle inheritance', 'bundle': self.cssbundle_name, - 'glob': 'test_assetsbundle/static/src/css/test_cssfile3.css', + 'path': 'test_assetsbundle/static/src/css/test_cssfile3.css', }) ltr_bundle1 = self._get_asset(self.cssbundle_name) @@ -732,7 +732,7 @@ class TestAssetsBundleInBrowser(HttpCase): self.env['ir.asset'].create({ 'name': 'lol', 'bundle': 'test_assetsbundle.bundle1', - 'glob': custom_url, + 'path': custom_url, }) self.browser_js( "/test_assetsbundle/js", @@ -907,7 +907,7 @@ class TestAssetsManifest(AddonManifestPatched): self.env['ir.asset'].create({ 'name': 'test_jsfile4', 'bundle': 'test_assetsbundle.manifest4', - 'glob': 'test_assetsbundle/static/src/js/test_jsfile1.js', + 'path': 'test_assetsbundle/static/src/js/test_jsfile1.js', }) view._render() attach = self.env['ir.attachment'].search([('name', 'ilike', 'test_assetsbundle.manifest4.min.js')], order='create_date DESC', limit=1) @@ -928,7 +928,7 @@ class TestAssetsManifest(AddonManifestPatched): self.env['ir.asset'].create({ 'name': 'test_jsfile4', 'bundle': 'test_assetsbundle.irasset1', - 'glob': 'test_assetsbundle/static/src/js/test_jsfile1.js', + 'path': 'test_assetsbundle/static/src/js/test_jsfile1.js', }) view._render() attach = self.env['ir.attachment'].search([('name', 'ilike', 'test_assetsbundle.irasset1.min.js')], order='create_date DESC', limit=1) @@ -948,7 +948,7 @@ class TestAssetsManifest(AddonManifestPatched): 'bundle': 'test_assetsbundle.manifest1', 'directive': 'replace', 'target': 'test_assetsbundle/static/src/js/test_jsfile1.js', - 'glob': 'http://external.link/external.js', + 'path': 'http://external.link/external.js', }) rendered = view._render() html_tree = lxml.etree.fromstring(rendered) @@ -978,7 +978,7 @@ class TestAssetsManifest(AddonManifestPatched): 'name': 'test_jsfile4', 'bundle': 'test_assetsbundle.manifest4', 'directive': 'replace', - 'glob': 'test_assetsbundle/static/src/js/test_jsfile1.js', + 'path': 'test_assetsbundle/static/src/js/test_jsfile1.js', 'target': 'test_assetsbundle/static/src/js/test_jsfile3.js', }) view._render() @@ -998,14 +998,14 @@ class TestAssetsManifest(AddonManifestPatched): 'name': 'test_jsfile4', 'directive': 'prepend', 'bundle': 'test_assetsbundle.manifest4', - 'glob': 'test_assetsbundle/static/src/js/test_jsfile4.js', + 'path': 'test_assetsbundle/static/src/js/test_jsfile4.js', }) # asset is now: js_file4 ; js_file3 self.env['ir.asset'].create({ 'name': 'test_jsfile4', 'bundle': 'test_assetsbundle.manifest4', 'directive': 'replace', - 'glob': 'test_assetsbundle/static/src/js/test_jsfile[12].js', + 'path': 'test_assetsbundle/static/src/js/test_jsfile[12].js', 'target': 'test_assetsbundle/static/src/js/test_jsfile[45].js', }) # asset is now: js_file1 ; js_file2 ; js_file3 @@ -1033,7 +1033,7 @@ class TestAssetsManifest(AddonManifestPatched): 'name': 'test_jsfile4', 'bundle': 'test_assetsbundle.manifest5', 'directive': 'remove', - 'glob': 'test_assetsbundle/static/src/js/test_jsfile2.js', + 'path': 'test_assetsbundle/static/src/js/test_jsfile2.js', }) view._render() attach = self.env['ir.attachment'].search([('name', 'ilike', 'test_assetsbundle.manifest5')], order='create_date DESC', limit=1) @@ -1056,7 +1056,7 @@ class TestAssetsManifest(AddonManifestPatched): self.env['ir.asset'].create({ 'name': 'test_jsfile4', 'bundle': 'test_assetsbundle.remove_error', - 'glob': '/test_assetsbundle/static/src/js/test_jsfile1.js', + 'path': '/test_assetsbundle/static/src/js/test_jsfile1.js', }) view = self.make_asset_view('test_assetsbundle.remove_error') @@ -1064,7 +1064,7 @@ class TestAssetsManifest(AddonManifestPatched): 'name': 'test_jsfile4', 'bundle': 'test_assetsbundle.remove_error', 'directive': 'remove', - 'glob': 'test_assetsbundle/static/src/js/test_doesntexist.js', + 'path': 'test_assetsbundle/static/src/js/test_doesntexist.js', }) with self.assertRaises(Exception) as cm: view._render() @@ -1078,7 +1078,7 @@ class TestAssetsManifest(AddonManifestPatched): 'name': 'test_jsfile4', 'bundle': 'test_assetsbundle.manifest2', 'directive': 'remove', - 'glob': 'test_assetsbundle/static/src/**/*', + 'path': 'test_assetsbundle/static/src/**/*', }) view._render() attach = self.env['ir.attachment'].search([('name', 'ilike', 'test_assetsbundle.manifest2.js')], order='create_date DESC', limit=1) @@ -1091,7 +1091,7 @@ class TestAssetsManifest(AddonManifestPatched): 'name': 'test_jsfile4', 'directive': 'prepend', 'bundle': 'test_assetsbundle.manifest4', - 'glob': 'test_assetsbundle/static/src/js/test_jsfile1.js', + 'path': 'test_assetsbundle/static/src/js/test_jsfile1.js', }) view._render() attach = self.env['ir.attachment'].search([('name', 'ilike', 'test_assetsbundle.manifest4')], order='create_date DESC', limit=1) @@ -1113,7 +1113,7 @@ class TestAssetsManifest(AddonManifestPatched): 'name': 'test_jsfile4', 'directive': 'include', 'bundle': 'test_assetsbundle.irasset_include1', - 'glob': 'test_assetsbundle.manifest6', + 'path': 'test_assetsbundle.manifest6', }) view._render() attach = self.env['ir.attachment'].search([('name', 'ilike', 'test_assetsbundle.irasset_include1')], order='create_date DESC', limit=1) @@ -1145,13 +1145,13 @@ class TestAssetsManifest(AddonManifestPatched): 'name': 'test_jsfile4', 'directive': 'include', 'bundle': 'test_assetsbundle.irasset_include1', - 'glob': 'test_assetsbundle.irasset_include2', + 'path': 'test_assetsbundle.irasset_include2', }) self.env['ir.asset'].create({ 'name': 'test_jsfile4', 'directive': 'include', 'bundle': 'test_assetsbundle.irasset_include2', - 'glob': 'test_assetsbundle.irasset_include1', + 'path': 'test_assetsbundle.irasset_include1', }) with self.assertRaises(QWebException) as cm: @@ -1168,30 +1168,30 @@ class TestAssetsManifest(AddonManifestPatched): 'name': 'test_jsfile4', 'directive': 'include', 'bundle': 'test_assetsbundle.irasset_include1', - 'glob': 'test_assetsbundle.irasset_include2', + 'path': 'test_assetsbundle.irasset_include2', }) self.env['ir.asset'].create({ 'name': 'test_jsfile4', 'directive': 'include', 'bundle': 'test_assetsbundle.irasset_include2', - 'glob': 'test_assetsbundle.irasset_include3', + 'path': 'test_assetsbundle.irasset_include3', }) self.env['ir.asset'].create({ 'name': 'test_jsfile4', 'directive': 'include', 'bundle': 'test_assetsbundle.irasset_include2', - 'glob': 'test_assetsbundle.irasset_include4', + 'path': 'test_assetsbundle.irasset_include4', }) self.env['ir.asset'].create({ 'name': 'test_jsfile4', 'directive': 'include', 'bundle': 'test_assetsbundle.irasset_include4', - 'glob': 'test_assetsbundle.irasset_include3', + 'path': 'test_assetsbundle.irasset_include3', }) self.env['ir.asset'].create({ 'name': 'test_jsfile4', 'bundle': 'test_assetsbundle.irasset_include3', - 'glob': 'test_assetsbundle/static/src/js/test_jsfile1.js', + 'path': 'test_assetsbundle/static/src/js/test_jsfile1.js', }) view._render() attach = self.env['ir.attachment'].search([('name', 'ilike', 'test_assetsbundle.irasset_include1')], order='create_date DESC', limit=1) @@ -1372,12 +1372,12 @@ class TestAssetsManifest(AddonManifestPatched): self.env['ir.asset'].create({ 'name': '1', 'bundle': 'test_assetsbundle.irasset2', - 'glob': 'http://external.css/externalstyle.css', + 'path': 'http://external.css/externalstyle.css', }) self.env['ir.asset'].create({ 'name': '2', 'bundle': 'test_assetsbundle.irasset2', - 'glob': 'test_assetsbundle/static/src/css/test_cssfile1.css', + 'path': 'test_assetsbundle/static/src/css/test_cssfile1.css', }) view = self.make_asset_view('test_assetsbundle.irasset2', { 't-js': 'false', @@ -1399,12 +1399,12 @@ class TestAssetsManifest(AddonManifestPatched): self.env['ir.asset'].create({ 'name': '1', 'bundle': 'test_assetsbundle.irasset2', - 'glob': 'http://external.css/externalstyle.css', + 'path': 'http://external.css/externalstyle.css', }) self.env['ir.asset'].create({ 'name': '2', 'bundle': 'test_assetsbundle.irasset2', - 'glob': 'test_assetsbundle/static/src/scss/test_file1.scss', + 'path': 'test_assetsbundle/static/src/scss/test_file1.scss', }) view = self.make_asset_view('test_assetsbundle.irasset2', { 't-js': 'false', @@ -1561,7 +1561,7 @@ class TestAssetsManifest(AddonManifestPatched): self.env['ir.asset'].create({ 'name': '1', 'bundle': 'test_assetsbundle.bundle4', - 'glob': '/test_assetsbundle/static/src/js/test_jsfile4.js', + 'path': '/test_assetsbundle/static/src/js/test_jsfile4.js', 'target': '/test_assetsbundle/static/src/js/test_jsfile3.js', 'directive': 'before', }) @@ -1590,7 +1590,7 @@ class TestAssetsManifest(AddonManifestPatched): self.env['ir.asset'].create({ 'name': '1', 'bundle': 'test_assetsbundle.bundle4', - 'glob': '/test_assetsbundle/static/src/js/test_jsfile4.js', + 'path': '/test_assetsbundle/static/src/js/test_jsfile4.js', 'target': '/test_assetsbundle/static/src/js/test_jsfile2.js', 'directive': 'after', }) @@ -1619,14 +1619,14 @@ class TestAssetsManifest(AddonManifestPatched): self.env['ir.asset'].create({ 'name': '1', 'bundle': 'test_assetsbundle.bundle4', - 'glob': '/test_assetsbundle/static/src/js/test_jsfile4.js', + 'path': '/test_assetsbundle/static/src/js/test_jsfile4.js', 'target': '/test_assetsbundle/static/src/css/test_cssfile1.css', 'directive': 'after', }) self.env['ir.asset'].create({ 'name': '1', 'bundle': 'test_assetsbundle.bundle4', - 'glob': '/test_assetsbundle/static/src/css/test_cssfile3.css', + 'path': '/test_assetsbundle/static/src/css/test_cssfile3.css', 'target': '/test_assetsbundle/static/src/js/test_jsfile2.js', 'directive': 'before', }) @@ -1681,12 +1681,12 @@ class TestAssetsManifest(AddonManifestPatched): self.env['ir.asset'].create({ 'name': '1', 'bundle': 'test_assetsbundle.wrong_path', - 'glob': '/test_assetsbundle/static/src/js/test_jsfile4.js', + 'path': '/test_assetsbundle/static/src/js/test_jsfile4.js', }) self.env['ir.asset'].create({ 'name': '1', 'bundle': 'test_assetsbundle.wrong_path', - 'glob': '/test_assetsbundle/static/src/js/test_jsfile1.js', + 'path': '/test_assetsbundle/static/src/js/test_jsfile1.js', 'target': '/test_assetsbundle/static/src/js/doesnt_exist.js', 'directive': 'after', }) @@ -1701,7 +1701,7 @@ class TestAssetsManifest(AddonManifestPatched): self.env['ir.asset'].create({ 'name': '1', 'bundle': 'test_assetsbundle.manifest4', - 'glob': '/test_assetsbundle/static/src/*/**', + 'path': '/test_assetsbundle/static/src/*/**', 'target': '/test_assetsbundle/static/src/js/test_jsfile3.js', 'directive': 'after', }) @@ -1730,7 +1730,7 @@ class TestAssetsManifest(AddonManifestPatched): self.env['ir.asset'].create({ 'name': '1', 'bundle': 'test_assetsbundle.manifest4', - 'glob': '/test_assetsbundle/static/src/js/test_jsfile[124].js', + 'path': '/test_assetsbundle/static/src/js/test_jsfile[124].js', 'target': '/test_assetsbundle/static/src/js/test_jsfile3.js', 'directive': 'before', }) @@ -1765,7 +1765,7 @@ class TestAssetsManifest(AddonManifestPatched): self.env['ir.asset'].create({ 'name': '1', 'bundle': 'test_assetsbundle.irassetsec', - 'glob': '/test_assetsbundle/%s' % path_to_dummy, + 'path': '/test_assetsbundle/%s' % path_to_dummy, }) view = self.make_asset_view('test_assetsbundle.irassetsec') view._render() @@ -1782,7 +1782,7 @@ class TestAssetsManifest(AddonManifestPatched): self.env['ir.asset'].create({ 'name': '1', 'bundle': 'test_assetsbundle.irassetsec', - 'glob': '/test_assetsbundle/%s' % path_to_dummy, + 'path': '/test_assetsbundle/%s' % path_to_dummy, }) files = self.env['ir.asset']._get_asset_paths('test_assetsbundle.irassetsec', addons=self.installed_modules, xml=False) @@ -1797,7 +1797,7 @@ class TestAssetsManifest(AddonManifestPatched): self.env['ir.asset'].create({ 'name': '1', 'bundle': 'test_assetsbundle.irassetsec', - 'glob': '/notinstalled_module/somejsfile.js', + 'path': '/notinstalled_module/somejsfile.js', }) view = self.make_asset_view('test_assetsbundle.irassetsec') with self.assertRaises(QWebException) as cm: @@ -1809,7 +1809,7 @@ class TestAssetsManifest(AddonManifestPatched): self.env['ir.asset'].create({ 'name': '1', 'bundle': 'test_assetsbundle.irassetsec', - 'glob': '/notinstalled_module/somejsfile.js', + 'path': '/notinstalled_module/somejsfile.js', }) self.make_asset_view('test_assetsbundle.irassetsec') attach = self.env['ir.attachment'].search([('name', 'ilike', 'test_assetsbundle.irassetsec')], order='create_date DESC', limit=1) @@ -1820,7 +1820,7 @@ class TestAssetsManifest(AddonManifestPatched): self.env['ir.asset'].create({ 'name': '1', 'bundle': 'test_assetsbundle.irassetsec', - 'glob': '/test_assetsbundle/__manifest__.py', + 'path': '/test_assetsbundle/__manifest__.py', }) view = self.make_asset_view('test_assetsbundle.irassetsec') view._render() @@ -1832,7 +1832,7 @@ class TestAssetsManifest(AddonManifestPatched): self.env['ir.asset'].create({ 'name': '1', 'bundle': 'test_assetsbundle.irassetsec', - 'glob': '/test_assetsbundle/data/ir_asset.xml', + 'path': '/test_assetsbundle/data/ir_asset.xml', }) files = self.env['ir.asset']._get_asset_paths('test_assetsbundle.irassetsec', addons=self.installed_modules, xml=False) self.assertFalse(files) @@ -1841,7 +1841,7 @@ class TestAssetsManifest(AddonManifestPatched): self.env['ir.asset'].create({ 'name': '1', 'bundle': 'test_assetsbundle.irassetsec', - 'glob': '/test_assetsbundle/static/accessible.xml', + 'path': '/test_assetsbundle/static/accessible.xml', }) files = self.env['ir.asset']._get_asset_paths('test_assetsbundle.irassetsec', addons=self.installed_modules, xml=False) self.assertEqual(len(files), 1) @@ -1866,7 +1866,7 @@ class TestAssetsManifest(AddonManifestPatched): self.env['ir.asset'].create({ 'name': '1', 'bundle': 'test_assetsbundle.irasset_custom_attach', - 'glob': 'test_assetsbundle/my_style_attach.scss', + 'path': 'test_assetsbundle/my_style_attach.scss', }) view = self.make_asset_view('test_assetsbundle.irasset_custom_attach', {'t-css': True}) view._render()