[FIX] hr_attendance: kiosk keep alive
When running in kiosk mode, it is necessary to refresh the interface
once a week since the session is garbage collected.
The garbage collection method `session_gc` relies on the last
modification time of the session file. However, the session file is only
saved when the field key `should_save` of the session request is `True`.
This happens when the session is `modified`, i.e. an item on the cookie
is set.
In practice, the session is saved at each reload of the page. Regular
RPC calls, such as the one used in commit 6e1b660f9c, do not
trigger a modification of the session file. Therefore, we create a new
route which explicitly sets the session as `modified`, which ultimately
triggers a `save` in `get_response`.
opw-1917254
closes odoo/odoo#29919
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import controllers
|
||||
from . import models
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import main
|
||||
@@ -0,0 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import http
|
||||
from odoo.http import request
|
||||
|
||||
|
||||
class HrAttendance(http.Controller):
|
||||
@http.route('/hr_attendance/kiosk_keepalive', auth='user', type='json')
|
||||
def kiosk_keepalive(self):
|
||||
request.httprequest.session.modified = True
|
||||
return {}
|
||||
@@ -69,7 +69,7 @@ var KioskMode = AbstractAction.extend({
|
||||
|
||||
_callServer: function () {
|
||||
// Make a call to the database to avoid the auto close of the session
|
||||
return ajax.rpc("/web/webclient/version_info", {});
|
||||
return ajax.rpc("/hr_attendance/kiosk_keepalive", {});
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user