This question has been flagged
1 Reply
1721 Views

I am using the widget of live chat in my external application. When I am modifying the function in the built-in addons file of public_livechat.js the change is affecting but when I am overriding the function the change is not taking effect. No module load error or function error is occurring but unable to get the change. I am trying it for a very long time but am unable to do so. Can anyone please help me?


Here is my code below.


1) views/web_public_livechat.xml:


    
        
            
        
    


    


2) static/src/js/public_livechat_override:


odoo.define("aveta.livechat_inherit", function (require) {
"use strict";

console.log('dsfkjadjfhjhdsfjhjksdf');

var WebsiteLivechatMessage = require("im_livechat.WebsiteLivechatMessage");

WebsiteLivechatMessage.include({
getDisplayedAuthor: function () {
var link = window.location["href"];
var get_name = link.split("name=");

console.log("jdjfkjdafjaksdkfjkfd");

if (this._super.apply(this, arguments)){
return this._super.apply(this, arguments);
} else {
this._defaultUsername = get_name[1];
return this._defaultUsername;
}
},
});

return WebsiteLivechatMessage;
}
);
Avatar
Discard
Author

views/web_public_livechat.xml:

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<template id="external_lib">
<script type="text/javascript" src="aveta/static/src/js/livechat_inherit.js"></script>
</template>
</data>
</odoo>

Best Answer

Hi,

Change the require to

var WebsiteLivechatMessage = require('im_livechat.legacy.im_livechat.model.WebsiteLivechatMessage');

Regards

Avatar
Discard