|
@ -8,11 +8,38 @@ odoo.define('pos_quick_logout.pos_quick_logout', function (require) { |
|
|
"use strict"; |
|
|
"use strict"; |
|
|
|
|
|
|
|
|
var chrome = require('point_of_sale.chrome'); |
|
|
var chrome = require('point_of_sale.chrome'); |
|
|
|
|
|
var core = require('web.core'); |
|
|
|
|
|
|
|
|
/* ******************************************************** |
|
|
/* ******************************************************** |
|
|
chrome.Chrome |
|
|
chrome.Chrome |
|
|
******************************************************** */ |
|
|
******************************************************** */ |
|
|
chrome.Chrome.include({ |
|
|
chrome.Chrome.include({ |
|
|
|
|
|
start: function(){ |
|
|
|
|
|
var self = this; |
|
|
|
|
|
this._super(); |
|
|
|
|
|
this.timer = false; |
|
|
|
|
|
this.idletimeout(); |
|
|
|
|
|
}, |
|
|
|
|
|
idletimeout: function() { |
|
|
|
|
|
var self = this; |
|
|
|
|
|
$(document).bind('mousemove keypress mousedown click scroll', function(){ |
|
|
|
|
|
self.resetTimer(); |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
logout: function() { |
|
|
|
|
|
var self = this; |
|
|
|
|
|
if (self.widget.username) { |
|
|
|
|
|
self.pos.set_cashier(self.pos.user); |
|
|
|
|
|
self.widget.username.renderElement(); |
|
|
|
|
|
}; |
|
|
|
|
|
}, |
|
|
|
|
|
resetTimer: function() { |
|
|
|
|
|
var self = this; |
|
|
|
|
|
clearTimeout(this.timer); |
|
|
|
|
|
this.timer = setTimeout(function(){ |
|
|
|
|
|
self.logout(); |
|
|
|
|
|
}, self.pos.config.logout_timeout * 1000); // time is in milliseconds
|
|
|
|
|
|
}, |
|
|
renderElement: function(){ |
|
|
renderElement: function(){ |
|
|
this._super(); |
|
|
this._super(); |
|
|
var self = this; |
|
|
var self = this; |
|
|