diff options
| author | qsm-odoo <qsm@odoo.com> | 2020-02-03 18:06:39 +0000 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2020-02-05 10:48:44 +0000 |
| commit | 6f4c60fe1bb6e460ec6da00c59a9825271893729 (patch) | |
| tree | 1e1daccae6866dcceba5854a1f2dd26aacfd7777 /addons/website/tests/test_ui.py | |
| parent | d04ca05b2ee33ee270866ba9ac8eed61a251c1ed (diff) | |
[FIX] website, *: lazy load widget assets of the correct website
*: web
Before this commit, when a widget declared assets to lazy load through
the assetLibs key, the asset was loaded through a context-less call to
the server through the base `rpc` function. This caused problems in
website: the website ID was not given to the called route and the loaded
assets were then stripped of their specific-website parts.
This commit solves the problem by allowing the `loadLibs` and
`loadAsset` functions to receive an extra argument: an extra `context`
to use for the actual call to the server. The method is now available
in the ajax service, so that website can add its custom context
automatically, the same way it does it for normal `_rpc` calls.
Part of https://github.com/odoo/odoo/pull/44596
closes odoo/odoo#44596
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/website/tests/test_ui.py')
| -rw-r--r-- | addons/website/tests/test_ui.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/addons/website/tests/test_ui.py b/addons/website/tests/test_ui.py index 98e06dc7924..b0bfa241226 100644 --- a/addons/website/tests/test_ui.py +++ b/addons/website/tests/test_ui.py @@ -112,3 +112,21 @@ class TestUi(odoo.tests.HttpCase): def test_04_backend_dashboard(self): self.start_tour("/", 'backend_dashboard', login='admin') + + def test_05_specific_website_editor(self): + website_default = self.env['website'].search([], limit=1) + new_website = self.env['website'].create({'name': 'New Website'}) + website_editor_assets_view = self.env.ref('website.assets_wysiwyg') + self.env['ir.ui.view'].create({ + 'name': 'Editor Extension', + 'type': 'qweb', + 'inherit_id': website_editor_assets_view.id, + 'website_id': new_website.id, + 'arch': """ + <xpath expr="." position="inside"> + <script type="text/javascript">document.body.dataset.hello = 'world';</script> + </xpath> + """, + }) + self.start_tour("/?fw=%s" % website_default.id, "generic_website_editor", login='admin') + self.start_tour("/?fw=%s" % new_website.id, "specific_website_editor", login='admin') |
