diff options
| author | Achraf (abz) <abz@odoo.com> | 2020-12-14 10:46:13 +0000 |
|---|---|---|
| committer | Achraf (abz) <abz@odoo.com> | 2020-12-15 06:15:10 +0000 |
| commit | a0c7880c0bd25fc8c5dd23755acc59966c62cbf9 (patch) | |
| tree | fb79b2993da0bf23a5ec582708142505c26bd0a8 /addons | |
| parent | d68ae11c233589895c4e78178ef5b146238b543e (diff) | |
[FIX] web: Load odoo script after other scripts
What are the steps to reproduce your issue ?
1. Install website
2. Connect on the website
3. Choose Customize > HTML/CSS/JS Editor
4. Choose "Web layout" (in "XML (HTML)" )
5. Modify the HTML code by adding any <script> before the existing <script> (console.log whatever)
6. Save
7. Refresh
What is currently happening ?
Traceback: TypeError: Cannot read property 'user_context' of undefined
How to fix the bug ?
Target the odoo script by id in the xpath.
opw-2375490
closes odoo/odoo#63357
X-original-commit: 0b7ba571431d694dea7db3ba1da4c7e86d1013e5
Signed-off-by: Achraf <abz-odoo@users.noreply.github.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/web/views/webclient_templates.xml | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/web/views/webclient_templates.xml b/addons/web/views/webclient_templates.xml index 7973f16d39b..15ee73f985f 100644 --- a/addons/web/views/webclient_templates.xml +++ b/addons/web/views/webclient_templates.xml @@ -447,7 +447,7 @@ <title t-esc="title or 'Odoo'"/> <link type="image/x-icon" rel="shortcut icon" t-att-href="x_icon or '/web/static/src/img/favicon.ico'"/> - <script type="text/javascript"> + <script id="web.layout.odooscript" type="text/javascript"> var odoo = { csrf_token: "<t t-esc="request.csrf_token(None)"/>", debug: "<t t-esc="debug"/>", @@ -471,7 +471,7 @@ <t t-call-assets="web.assets_common" t-js="false"/> <t t-call-assets="web.assets_frontend" t-js="false"/> </xpath> - <xpath expr="//head/script" position="after"> + <xpath expr="//head/script[@id='web.layout.odooscript']" position="after"> <script type="text/javascript"> odoo.session_info = <t t-raw="json.dumps(request.env['ir.http'].get_frontend_session_info())"/>; if (!/(^|;\s)tz=/.test(document.cookie)) { |
