diff options
| author | LofbergValentin <lofbergvalentin@gmail.com> | 2018-05-24 16:00:11 +0200 |
|---|---|---|
| committer | Yannick Tivisse <yti@openerp.com> | 2018-05-24 16:47:12 +0200 |
| commit | 6e1b660f9c76a412dcd78d7f7de593ae318c00bd (patch) | |
| tree | b89bb825895d25f81469f25ef0fc9acc698cc20c | |
| parent | 299b613da355a94a33f0db1bbe7820fe6e8fd8f1 (diff) | |
[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.
| -rw-r--r-- | addons/hr_attendance/static/src/js/kiosk_mode.js | 9 |
1 files changed, 9 insertions, 0 deletions
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); |
