Repository navigation
Conversation
Keep each user's time zone in line with the device they use. Odoo only reads the browser time zone at login, from a cookie set by its own login page, and only when the user has none. Users logging in through an external identity provider never get one, and travelling never changes it, so e-mails, reports, deadlines and scheduled actions use the wrong time zone. Each time the interface opens, the device time zone is compared with the user's one and, when they differ, written by the server (known pytz zone, current user only, setting enabled, never while impersonating nor for the superuser). The first page already uses it; the interface never waits more than two seconds. Users can uncheck "Automatic Time Zone" in their Preferences to keep a fixed one. Signed-off-by: Claude Perrin <klodr@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New module: web_timezone_auto
Keeps each user's time zone in line with the device they use.
Problem. Odoo only reads the browser time zone at login, from the
tzcookie set by its own login page, and only when the user has no time zone yet (res.users._login). Users who log in through an external identity provider (OAuth/OIDC) skip that page, so their time zone stays empty and the Preferences show the mismatch warning; users who travel keep their old time zone. The server then computes e-mails, reports, activity deadlines and scheduled actions in the wrong time zone, while the web client shows the device time.What the module does.
tz_auto) on users, checked by default (existing users included), readable and writable by the user.Intl.DateTimeFormat().resolvedOptions().timeZone) differs from the user's, the client asks the server to write it; the server decides (res.users.web_timezone_auto_sync): knownpytzzone only, current user only, setting on, never for the superuser, never while impersonating (impersonate_login). It writes only when the zone actually changes (writingtzclears the server caches), updates the session context, and returns the zone so the page and other tabs use it.Tests. Python (12) including two real HTTP sessions (session context updated at once; nothing written while impersonating), and Hoot (8) including the startup wait and a silent server. Each rule was removed in turn to check that its test fails.
Field use. Deployed on our instance (production and three client databases) since 2026-10-25.
Translations will go through Weblate.