Skip to content

[20.0][MIG] auth_session_timeout: Migration to 20.0 - #1073

Open
Pani-k-folk wants to merge 40 commits into
OCA:20.0from
ecosoft-odoo:20.0-mig-auth_session_timeout
Open

Pani-k-folk wants to merge 40 commits into
OCA:20.0from
ecosoft-odoo:20.0-mig-auth_session_timeout

Conversation

@Pani-k-folk

@Pani-k-folk Pani-k-folk commented Nov 20, 2026 •

Copy link
Copy Markdown

Odoo 20 changes handled

  • ir.config_parameter.get_param() / set_param() were removed in 20.0: use get_int() / get_str() (and set_int() / set_str() in tests).
  • odoo.http is now a package that no longer re-exports the session API:
    • SessionExpiredException imported from odoo.http.session
    • session.logout(keep_db=True) → logout(session, keep_db=True)
    • http.root.session_store.get_session_filename(sid) → session_store().get_session_path(sid)
  • tools.ormcache → api.ormcache; registry.clear_cache() → transaction.invalidate_ormcache().
  • Manifest: version 20.0.1.0.0, one-line summary (new pylint-odoo manifest-summary-multiline check).

No functional change: same system parameters (inactive_session_time_out_delay, inactive_session_time_out_ignored_url), same defaults, same pluggable _auth_timeout_* methods.

AI disclosure

Assisted-by: Claude Opus 5.5 (migration changes were reviewed and tested by me)

pedrobaeza and others added 30 commits November 20, 2026 13:48
… True * Add Usage section to ReadMe w/ Runbot link * `_crypt_context` now directly exposes the `CryptContext` * Change all instances of openerp to odoo * Add test coverage to IrConfigParameter * Add test coverage for res.users * Remove db from `get_session_parameters` method call * Remove deprecated skiparg for ormcache * Fix tests & lint * Switch cache to use self.cr.dbname * Fix ormcache
* Module auth_session_timeout:
---------------------------

* Refactor to allow other modules to inherit and augment or override the following:
** Session expiry time (deadline) calculation
** Ignored URLs
** Final session expiry (with possibility to late-abort)
* Re-ordered functionality to remove unnecessary work, as this code is called very often.
* Do not expire a session if delay gets set to zero (or unset / false)

* WIP

* Fixed flake8 lint errors

* Fixed flake8 lint errors

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* Module: auth-session-timeout: Refactor ResUser tests to use `unittest.mock` patching

* Module: auth_session_timeout: Fixed flake8 lint errors

* Module: auth_session_timeout: Fixed flake8 lint errors
…e backwards compatibility methods that were retained during v9 rework * Upgrade API and rename a few things for PEP-8 * Switch to HttpCase for tests * Switch to isolated build
…OCA#1070)

* corrects AttributeError: 'HttpRequest' object has no attribute 'http'

* updates the module version number for pull request OCA#1070
New changes for move module, clean module, apply new oca guideline and make
compatible with 11.0:

* Move module from oca/server-tools:10.0  to oca/server-auth:11.0
* Remove .DS_Store files, addd by mistake in early changes and not needed.
* Fix error when make RPC request. Applied thanks to comment added by @christophlsa. For more information go to OCA/server-tools#1163 (review)
* Update version to the first one in 11.0
* Update README to match new guideline
* Remove she bang coding
* Use _authenticate method instead of deprecated method check. For more information go to https://github.com/odoo/odoo/blob/11.0/odoo/http.py#L1049
* Improve auth_session_timeout method return raise SessionExpiredException exception instead of False. This will show a "session expired please reload page" message to the user.
* Fix update unitet test. make then turn green and the update then to make them match with new changes

  - There was not getmtime() result definied in this test case, For that reason was returning a MagicMock() object, For this case their are trying to test that the session is valid, this is the same that the path of the file with session is not expired. To simulate that I just updated for the test case the getmtime() result to a value that will be greater than the delay expected: I used the current time This way when evaluationg if the sessions is expire will return False instead of TypeError: unorderable types: MagicMock() < float() The unit test still works the same and the result is without errors.

* Fix plylint errors:

  - E302 expected 2 blank lines,
  - Not used variable and not valid var name. Remove e varaible since is not valid name and this one is not been used.
Currently translated at 100.0% (3 of 3 strings)

Translation: server-auth-12.0/server-auth-12.0-auth_session_timeout
Translate-URL: https://translation.odoo-community.org/projects/server-auth-12-0/server-auth-12-0-auth_session_timeout/pt_BR/
Make it so session timeout doe not apply to requests
to a route with auth_method="public".

Forward port of OCA#258
Currently translated at 100.0% (3 of 3 strings)

Translation: server-auth-14.0/server-auth-14.0-auth_session_timeout
Translate-URL: https://translation.odoo-community.org/projects/server-auth-14-0/server-auth-14-0-auth_session_timeout/pt_BR/
Currently translated at 100.0% (3 of 3 strings)

Translation: server-auth-15.0/server-auth-15.0-auth_session_timeout
Translate-URL: https://translation.odoo-community.org/projects/server-auth-15-0/server-auth-15-0-auth_session_timeout/ca/
Currently translated at 100.0% (3 of 3 strings)

Translation: server-auth-15.0/server-auth-15.0-auth_session_timeout
Translate-URL: https://translation.odoo-community.org/projects/server-auth-15-0/server-auth-15-0-auth_session_timeout/it/
Currently translated at 100.0% (3 of 3 strings)

Translation: server-auth-15.0/server-auth-15.0-auth_session_timeout
Translate-URL: https://translation.odoo-community.org/projects/server-auth-15-0/server-auth-15-0-auth_session_timeout/it/
…, but /web is a public route, so it does not trigger the session check but it does trigger session save, so the file mtime is updated before the second HTTP call makes the check takes place, and session is not expired
Currently translated at 100.0% (3 of 3 strings)

Translation: server-auth-16.0/server-auth-16.0-auth_session_timeout
Translate-URL: https://translation.odoo-community.org/projects/server-auth-16-0/server-auth-16-0-auth_session_timeout/es/
Currently translated at 100.0% (3 of 3 strings)

Translation: server-auth-16.0/server-auth-16.0-auth_session_timeout
Translate-URL: https://translation.odoo-community.org/projects/server-auth-16-0/server-auth-16-0-auth_session_timeout/es/
Currently translated at 100.0% (3 of 3 strings)

Translation: server-auth-16.0/server-auth-16.0-auth_session_timeout
Translate-URL: https://translation.odoo-community.org/projects/server-auth-16-0/server-auth-16-0-auth_session_timeout/it/
Currently translated at 100.0% (3 of 3 strings)

Translation: server-auth-16.0/server-auth-16.0-auth_session_timeout
Translate-URL: https://translation.odoo-community.org/projects/server-auth-16-0/server-auth-16-0-auth_session_timeout/ca/
@OCA-git-bot OCA-git-bot added series:20.0 mod:auth_session_timeout Module auth_session_timeout labels Nov 20, 2026
@Pani-k-folk
Pani-k-folk force-pushed the 20.0-mig-auth_session_timeout branch from 4291fb2 to f4e873d Compare November 20, 2026 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:auth_session_timeout Module auth_session_timeout series:20.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.