From 6e1b660f9c76a412dcd78d7f7de593ae318c00bd Mon Sep 17 00:00:00 2001 From: LofbergValentin Date: Thu, 24 May 2018 16:00:11 +0200 Subject: [PATCH] [FIX] hr_attendance: Keep the kiosk session alive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- addons/hr_attendance/static/src/js/kiosk_mode.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/addons/hr_attendance/static/src/js/kiosk_mode.js b/addons/hr_attendance/static/src/js/kiosk_mode.js index 51c78bd34b4..9a7e2898df1 100644 --- a/addons/hr_attendance/static/src/js/kiosk_mode.js +++ b/addons/hr_attendance/static/src/js/kiosk_mode.js @@ -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);