|
|
@ -1,13 +1,13 @@ |
|
|
|
/** @odoo-module **/ |
|
|
|
import SystrayMenu from 'web.SystrayMenu'; |
|
|
|
import Widget from 'web.Widget'; |
|
|
|
var ajax = require('web.ajax'); |
|
|
|
var core = require('web.core'); |
|
|
|
import ajax from 'web.ajax'; |
|
|
|
import core from 'web.core'; |
|
|
|
var qweb = core.qweb; |
|
|
|
|
|
|
|
var GetUser = Widget.extend({ |
|
|
|
/** |
|
|
|
function run before loading the page to call methode "get_idle_time" |
|
|
|
function run before loading the page to call method "get_user" |
|
|
|
*/ |
|
|
|
willStart: function() { |
|
|
|
var self = this; |
|
|
@ -19,15 +19,30 @@ var GetUser = Widget.extend({ |
|
|
|
Getting minutes through python for the corresponding user in the backend |
|
|
|
*/ |
|
|
|
get_user: function() { |
|
|
|
var self = this |
|
|
|
var now = new Date().getTime(); |
|
|
|
var self = this; |
|
|
|
ajax.rpc('/get_ip').then(function(data) { |
|
|
|
console.log(data) |
|
|
|
if (data == false){ |
|
|
|
location.replace("/web/session/logout") |
|
|
|
} |
|
|
|
}) |
|
|
|
}); |
|
|
|
}, |
|
|
|
/** |
|
|
|
Binding mouseup event |
|
|
|
*/ |
|
|
|
start: function() { |
|
|
|
var self = this; |
|
|
|
this._super.apply(this, arguments).then(function() { |
|
|
|
$(document).on('mouseup', self.onMouseUp.bind(self)); |
|
|
|
}); |
|
|
|
}, |
|
|
|
/** |
|
|
|
Function to be called on mouseup event |
|
|
|
*/ |
|
|
|
onMouseUp: function(event) { |
|
|
|
this.get_user(); |
|
|
|
}, |
|
|
|
}); |
|
|
|
|
|
|
|
// Ensure the widget is added to the Systray menu
|
|
|
|
SystrayMenu.Items.push(GetUser); |
|
|
|
export default GetUser; |
|
|
|
export default GetUser; |
|
|
|