mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
This commit adds the web_session_auto_close module which purpose is to is to automatically close the session when the last odoo tab is closed or when the computer gets in idle mode. The `timeout` occurs 15 seconds after the tab has been closed or the computer got idle.
25 lines
806 B
JavaScript
25 lines
806 B
JavaScript
odoo.define("web_session_auto_close.WebClient", function(require) {
|
|
"use strict";
|
|
|
|
const WebClient = require("web.WebClient");
|
|
|
|
return WebClient.include({
|
|
dependencies: ["bus_service", WebClient.prototype.dependencies],
|
|
|
|
/**
|
|
* @override
|
|
*/
|
|
start: function() {
|
|
const isSessionStillValid = this.call("bus_service", "isSessionStillValid");
|
|
if (!isSessionStillValid) {
|
|
window.location = "/web/session/logout";
|
|
return;
|
|
}
|
|
const result = this._super.apply(this, arguments);
|
|
// We need to ensure that the polling has started as this module relies on that process.
|
|
this.call("bus_service", "startPolling");
|
|
return result;
|
|
},
|
|
});
|
|
});
|