Can you show me how to call a widget in frontend on Odoo. I use Widget to put data to a template but it's not working.
<t t-name="VoipCallOutgoingNotification" t-extend="Notification">
<t t-jquery=".o_notification_title > t" t-operation="replace">
<span t-attf-class="link2event eid_{{widget.eid}}">
<t t-esc="widget.title"/>
</span>
</t>
<t t-jquery=".o_notification_content" t-operation="append">
<br/>
<img id="voipcalloutgoingimage"/><br/>
<span id="callsecondsoutgoingleft"></span> seconds remaining...<br/>
</t>
</t>
/*************Js code Here ******************************/
var VoipCallOutgoingNotification = Notification.extend({
template: "VoipCallOutgoingNotification",
init: function (parent, title, text, call_id) {
this._super(parent, title, text, true);
},
start: function () {
myNotif = this;
this._super.apply(this, arguments);
secondsLeft = countdown;
$("#callsecondsoutgoingleft").html(secondsLeft);
outgoing_ring_interval = setInterval(function () {
$("#callsecondsoutgoingleft").html(secondsLeft);
if (secondsLeft == 0) {
rpc.query({
model: 'voip.call',
method: 'miss_call',
args: [[call_id]]
}).then(function (result) {
console.log("Missed Call");
});
//Send the offer to message bank (server)
/*
if (mode == "audiocall") {
window.peerConnection.createOffer().then(messageBankDescription).catch(errorHandler);
}
*/
//Play the missed call audio
mySound = new Audio("/voip/miss/" + call_id + ".mp3");
mySound.play();
clearInterval(outgoing_ring_interval);
resetCall();
myNotif.destroy(true);
}
secondsLeft--;
}, 1000);
},
});
It is working for backend but in frontend