Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions web_session_auto_close/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

======================
Web Session Auto Close
======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:8244d213321585d6b7f6632ffc7e98fa6fb6902f1ac2e3e883efb596bbf55572
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
:target: https://github.com/OCA/web/tree/19.0/web_session_auto_close
:alt: OCA/web
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-19-0/web-19-0-web_session_auto_close
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=19.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module automatically closes inactive user sessions based on a
configurable timeout. If no activity is detected within the set
duration, the session is destroyed, and the page reloads.

**Table of contents**

.. contents::
:local:

Configuration
=============

The timeout can be adjusted in **Settings > General under "Session
Auto-Close Timeout"**, where the value is set in seconds.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_session_auto_close%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* ACSONE SA/NV

Contributors
------------

- Laurent Stukkens <laurent.stukkens@acsone.eu> (https://www.acsone.eu)
- Souheil Bejaoui <souheil.bejaoui@acsone.eu> (https://www.acsone.eu)
- `Komit <https://komit-consulting.com>`__:

- Vang Nguyen Phu

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/web <https://github.com/OCA/web/tree/19.0/web_session_auto_close>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions web_session_auto_close/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import controllers
from . import models
19 changes: 19 additions & 0 deletions web_session_auto_close/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2023 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Web Session Auto Close",
"summary": """Automatically logs out inactive users based on a configurable
timeout.""",
"version": "19.0.1.0.1",
"license": "AGPL-3",
"author": "ACSONE SA/NV, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/web",
"depends": ["web"],
"data": ["views/res_config_settings.xml"],
"assets": {
"web.assets_backend": [
"web_session_auto_close/static/src/js/session_auto_close.esm.js",
],
},
}
1 change: 1 addition & 0 deletions web_session_auto_close/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import main
22 changes: 22 additions & 0 deletions web_session_auto_close/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2025 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import http
from odoo.http import request


class WebSessionAutoCloseController(http.Controller):
@http.route("/web/session/get_timeout", type="jsonrpc", auth="user")
def get_session_timeout(self):
default_sec = 600
timeout_sec = (
request.env["ir.config_parameter"]
.sudo()
.get_param("web_session_auto_close.timeout", default_sec)
)
try:
timeout_int = int(timeout_sec)
except (TypeError, ValueError):
timeout_int = default_sec

return timeout_int * 1000
27 changes: 27 additions & 0 deletions web_session_auto_close/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_session_auto_close
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2025-06-09 10:26+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.10.4\n"

#. module: web_session_auto_close
#: model:ir.model,name:web_session_auto_close.model_res_config_settings
msgid "Config Settings"
msgstr "Impostazioni configurazione"

#. module: web_session_auto_close
#: model:ir.model.fields,field_description:web_session_auto_close.field_res_config_settings__session_auto_close_timeout
msgid "Session Auto-Close Timeout (seconds)"
msgstr "Timeout chiusura automatica sessione (secondi)"
24 changes: 24 additions & 0 deletions web_session_auto_close/i18n/web_session_auto_close.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_session_auto_close
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: web_session_auto_close
#: model:ir.model,name:web_session_auto_close.model_res_config_settings
msgid "Config Settings"
msgstr ""

#. module: web_session_auto_close
#: model:ir.model.fields,field_description:web_session_auto_close.field_res_config_settings__session_auto_close_timeout
msgid "Session Auto-Close Timeout (seconds)"
msgstr ""
1 change: 1 addition & 0 deletions web_session_auto_close/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import res_config_settings
14 changes: 14 additions & 0 deletions web_session_auto_close/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2025 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

session_auto_close_timeout = fields.Integer(
string="Session Auto-Close Timeout (seconds)",
config_parameter="web_session_auto_close.timeout",
default=600,
)
3 changes: 3 additions & 0 deletions web_session_auto_close/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
2 changes: 2 additions & 0 deletions web_session_auto_close/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
The timeout can be adjusted in **Settings > General under "Session Auto-Close Timeout"**,
where the value is set in seconds.
6 changes: 6 additions & 0 deletions web_session_auto_close/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- Laurent Stukkens \<<laurent.stukkens@acsone.eu>\>
(<https://www.acsone.eu>)
- Souheil Bejaoui \<<souheil.bejaoui@acsone.eu>\>
(<https://www.acsone.eu>)
- [Komit](https://komit-consulting.com):
- Vang Nguyen Phu
3 changes: 3 additions & 0 deletions web_session_auto_close/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module automatically closes inactive user sessions based on a
configurable timeout. If no activity is detected within the set
duration, the session is destroyed, and the page reloads.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading