Hello there,
We have made an override of the received_message javascript method of the im_chat module.
/home/odoo-iv/addons_pt/im_chat_lapagept/override.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="override_im_chat_backend" name="" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/im_chat_lapagept/static/src/js/override.js"></script>
</xpath>
</template>
<template id="override_im_chat_frontend" inherit_id="website.assets_frontend" name="">
<xpath expr="." position="inside">
<script type="text/javascript" src="/im_chat_lapagept/static/src/js/override.js"></script>
</xpath>
</template>
</data>
</openerp>
/home/odoo-iv/addons_pt/im_chat_lapagept/static/src/js/override.js
openerp.im_chat_lapagept = function(instance) {
instance.im_chat.ConversationManager.include({
received_message: function(message) {
var self = this;
var session_id = message.to_id[0];
var uuid = message.to_id[1];
//This code has been commented by us
//if (! this.get("window_focus")) {
//alert('gjhgjhg');
this.set("waiting_messages", this.get("waiting_messages") + 1);
//}
var conv = this.sessions[uuid];
if(!conv){
// fetch the session, and init it with the message
var def_session = new openerp.Model("im_chat.session").call("session_info", [], {"ids" : [session_id]}).then(function(session){
conv = self.activate_session(session, false);
conv.received_message(message);
});
}else{
conv.received_message(message);
}
},
})
}
This new code works well in the backend. But not on the frontend.
On the frontend, it seems that the original received_message method is still used.
We think that the problem is in the im_livechat.js file where the original received_message method is also overriden.
/home/odoo-iv/odoo-8.0-20161109/openerp/addons/im_livechat/static/src/js/im_livechat.js
openerp.im_chat.ConversationManager.include({
received_message: function(message) {
try{
this._super(message);
}catch(e){}
}
});
So our question is : how could we use our new method also in im_livechat.js???