[FIX] hr_attendance: Keep the kiosk session alive

closes #1800442

Purpose
=======

Odoo sessions are expired when no action has been triggered
for the last 7 days. For kiosk mode, this doesn’t make sense.

It means that once a week, a person with the rights to the
employee under kiosk mode, has to come to the screen and log in again.

Specification
=============

Trigger an action to keep the Odoo session alive.
This commit is contained in:
LofbergValentin
2018-05-24 16:47:12 +02:00
committed by Yannick Tivisse
parent 299b613da3
commit 6e1b660f9c
@@ -36,6 +36,8 @@ var KioskMode = Widget.extend(BarcodeHandlerMixin, {
self.$el.html(QWeb.render("HrAttendanceKioskMode", {widget: self}));
self.start_clock();
});
// Make a RPC call every day to keep the session alive
self._interval = window.setInterval(this._callServer.bind(this), (60*60*1000*24));
return self._super.apply(this, arguments);
},
@@ -60,8 +62,15 @@ var KioskMode = Widget.extend(BarcodeHandlerMixin, {
destroy: function () {
clearInterval(this.clock_start);
clearInterval(this._interval);
this._super.apply(this, arguments);
},
_callServer: function () {
// Make a call to the database to avoid the auto close of the session
return Session.rpc('/web/webclient/version_info', {})
},
});
core.action_registry.add('hr_attendance_kiosk_mode', KioskMode);