[FIX] im_livechat: livechat button not rely on JS services
Revision of https://github.com/odoo/odoo/commit/02ec09cb1c3e2d7bc7968f40c18f2208d7f3f498 One of the purposes of the previous commit was to test discuss. There was an attempt to test im_livechat, but it has been aborted due to the possibility to use livechat on an external website. However, some bits remain from this attempt, such as LivechatButton becoming a JS service provider in order to use those services with the external lib. LivechatButton was not working for the following reasons: - ServiceProviderMixin.init was not called (so it couldn't load any service); - On website, there are two service providers (LivechatButton & websiteRootInstance). This fix ensures that LivechatButton does not rely on JS services, such as the bus_service.
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
odoo.define('im_livechat.im_livechat', function (require) {
|
||||
"use strict";
|
||||
|
||||
var bus = require('bus.bus').bus;
|
||||
var config = require('web.config');
|
||||
var core = require('web.core');
|
||||
var ServiceProviderMixin = require('web.ServiceProviderMixin');
|
||||
var session = require('web.session');
|
||||
var time = require('web.time');
|
||||
var utils = require('web.utils');
|
||||
@@ -33,11 +33,7 @@ if (!_.contains(url_history, page)) {
|
||||
utils.set_cookie(LIVECHAT_COOKIE_HISTORY, JSON.stringify(url_history), 60*60*24); // 1 day cookie
|
||||
}
|
||||
|
||||
/**
|
||||
* In order to handle services like ajax in the external lib,
|
||||
* The parent of Livechat, LivechatButton, is set as a service provider
|
||||
*/
|
||||
var LivechatButton = Widget.extend(ServiceProviderMixin, {
|
||||
var LivechatButton = Widget.extend({
|
||||
className:"openerp o_livechat_button hidden-print",
|
||||
|
||||
events: {
|
||||
@@ -56,7 +52,7 @@ var LivechatButton = Widget.extend(ServiceProviderMixin, {
|
||||
this.chat_window = null;
|
||||
this.messages = [];
|
||||
this.server_url = server_url;
|
||||
this.busBus = this.call('bus_service', 'getBus');
|
||||
this.busBus = bus;
|
||||
},
|
||||
|
||||
willStart: function () {
|
||||
|
||||
@@ -142,7 +142,6 @@
|
||||
<script type="text/javascript" src="/web/static/src/js/services/local_storage_service.js"></script>
|
||||
<!-- Bus, Mail, Livechat -->
|
||||
<script type="text/javascript" src="/bus/static/src/js/bus.js"></script>
|
||||
<script type="text/javascript" src="/bus/static/src/js/services/bus_service.js"></script>
|
||||
<script type="text/javascript" src="/mail/static/src/js/chat_window.js"></script>
|
||||
<script type="text/javascript" src="/mail/static/src/js/thread.js"></script>
|
||||
<script type="text/javascript" src="/mail/static/src/js/document_viewer.js"></script>
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
<template id="assets_frontend" name="im_livechat assets frontend" inherit_id="website.assets_frontend">
|
||||
<xpath expr="." position="inside">
|
||||
<script type="text/javascript" src="/bus/static/src/js/bus.js"></script>
|
||||
<script type="text/javascript" src="/bus/static/src/js/services/bus_service.js"></script>
|
||||
<script type="text/javascript" src="/mail/static/src/js/chat_window.js"></script>
|
||||
<script type="text/javascript" src="/mail/static/src/js/document_viewer.js"></script>
|
||||
<script type="text/javascript" src="/mail/static/src/js/thread.js"></script>
|
||||
|
||||
Reference in New Issue
Block a user