Skip to content
Browse files

[FIX] im_livechat: fix the ajax loading on external website

The file "public_root.js" try to load "/web/webclient/locale/en_US" with ajax.loadJS
we do not have the address to the Odoo server, so we try to load the file locally
but this file might not exist on the website which is using the widget

Overwrite ``ajax.loadJS`` and ignore ajax loading
(also printing a warning message in the JS console)

Task #2081146

closes #41177

X-original-commit: 50f8508
Signed-off-by: std-odoo <>
  • Loading branch information
std-odoo committed Nov 4, 2019
1 parent 67951fe commit 88145eb645777b7292b1120c632ae75fdf3f4779
@@ -0,0 +1,14 @@
odoo.define('web.ajax_external', function (require) {
"use strict";

var ajax = require('web.ajax');

* This file should be used in the context of an external widget loading (e.g: live chat in a non-Odoo website)
* It overrides the 'loadJS' method that is supposed to load additional scripts, based on a relative URL (e.g: '/web/webclient/locale/en_US')
* As we're not in an Odoo website context, the calls will not work, and we avoid a 404 request.
ajax.loadJS = function (url) {
console.warn('Tried to load the following script on an external website: ' + url);
@@ -136,6 +136,7 @@
<script type="text/javascript" src="/web/static/src/js/core/collections.js"/>
<script type="text/javascript" src="/web/static/src/js/core/translation.js"></script>
<script type="text/javascript" src="/web/static/src/js/core/ajax.js"></script>
<script type="text/javascript" src="/im_livechat/static/src/js/ajax_external.js"></script>
<script type="text/javascript" src="/web/static/src/js/core/time.js"></script>
<script type="text/javascript" src="/web/static/src/js/core/mixins.js"></script>
<script type="text/javascript" src="/web/static/src/js/core/service_mixins.js"></script>

0 comments on commit 88145eb

Please sign in to comment.
You can’t perform that action at this time.