Odoo 19 · 20Tools$99

Session Control

Log people out after they have really been idle, a different number of minutes for each group, and see every session that is open right now

Request a live demo · Odoo.sh or On-Premise only, not Odoo Online (SaaS).

5 min

the shortest idle limit it accepts

1 min

the most a timeout can overrun

15

automated tests, none failing

0

sessions of other databases in the list

1

click to end any session but your own

base

the only module it depends on

Session Control is for the person who answers for who is signed in to an Odoo 19 database. It does two jobs and nothing else. First, it ends a session once its owner has made no request for as long as that person's group allows: ten minutes for the shared terminal on the loading dock, an hour for somebody at their own desk. Second, it lists the sessions that are open at this moment, with the user, when each began, when it was last used and how long it has been idle, and gives you one button to end any of them. Everything on this page was checked on an Odoo 19 database seeded with made-up users, including a live test in which a session was left alone until the app logged it out.

How it works

Why an idle timeout has to end the session

Use it when somebody asks why a shared terminal is still signed in at nine in the morning, or why the accountant and the warehouse have the same timeout.Ends sessions, writes one rule per group

Odoo counts how long a session may live with one setting for the entire database, the sessions.max_inactivity_seconds system parameter. The warehouse terminal and the finance director therefore get the same number, and it is a long one. That is the wrong answer to an auditor who asks why a shared screen in a loading bay stayed signed in all weekend.

Odoo also ships a module called Auth Timeout. Reading its code, its inactivity timer asks the person to confirm their identity again rather than ending the session, and its other timer counts from the moment the session was created, regardless of what the person did since. Both are useful, and neither is a limit on idle time that logs somebody out.

Session Control adds one rule per group: after this many minutes without a request, that user is logged out. A rule belongs to a group, so the people who need a short leash and the people who do not each get their own number, and each rule carries a note saying why. A second screen lists the sessions open now so that you can see the policy working and end a session by hand when you need to.

It is a small app on purpose. It adds a Session Control menu with two entries, three models and a check on each request. It does not add a login history, does not look at IP addresses and does not change how people sign in.

The whole app is two menu entries under Settings.

Northfield Office Supply has a Warehouse Terminal group for the two shared screens on the dock, a Finance Team group, and everyone else as internal users. The administrator sets ten minutes for the terminals, fifteen for finance and sixty for everybody, and writes the reason on each line. From then on a screen left alone on the dock is signed out after ten minutes without a request, and the finance team is signed out after fifteen.

It does not change what Auth Timeout does and does not replace it: the two can run side by side. It also does nothing about people who are active, which is the point of an idle timeout.

an idle limit written down per group, with the reason beside it, that really logs the person out instead of only asking for a password.

Session Control: Why an idle timeout has to end the session

1 Idle rules: set the minutes for each group

Use it when different groups need different leashes: a shared terminal ten minutes, a desk with a screen lock an hour.Writes a rule when saved

A single database-wide number cannot be right for everybody. Set it short and the finance team loses a half-typed journal entry at lunch. Set it long and the dock terminal stays signed in. The number has to belong to the people it is meant for, and in Odoo the people are the groups.

Idle Rules is a plain editable list with three columns: Group , Inactivity Minutes and Why . Add a line, choose the group, type the number, and that is the whole rule. A new rule starts at 30 minutes. The group picker only offers groups that exist: you cannot create a group from this field.

Each rule reads as a sentence wherever Odoo shows its name, for example Warehouse Terminal after 10 min . A rule can be archived from the Actions menu, which stops it applying without losing the line, and the rule list is the only place the policy lives.

Three rules, each with its minutes and its reason.

Select a rule and the Actions menu offers Archive, which switches it off without deleting it.

The administrator adds three lines. Warehouse Terminal , 10 minutes, Shared screens on the dock, IT audit finding . Finance Team , 15 minutes, Month-end close policy . Role / User , 60 minutes, Default for a desk with a screen lock . Three lines is the whole policy, and anybody who opens the list can read why each number was chosen.

It does not warn the person before logging them out, and it does not save what they were typing. The check runs when the next request arrives: the person finds out when they click.

Nothing is enforced for a user until a rule covers one of their groups. A user with no rule is never logged out by this app, and Odoo's own lifetime applies to them as before.

Session Control: 1 Idle rules: set the minutes for each group
Session Control: 1 Idle rules: set the minutes for each group

2 The shortest rule wins

Use it when people belong to several groups and you want a short timeout to stay short.Read-only: a decision, no data written

Real users sit in many groups at once. Priya Nair is a finance user and also an ordinary internal user. If the rules were read in an order and the first match won, a lenient rule could undo a strict one depending on nothing more than the sequence of the list. Anyone auditing the setting would then have to work out an order of precedence.

There is no precedence to learn. For each request the app looks at every group the user holds, picks the rules that name those groups and takes the smallest number of minutes. Priya is in Finance Team (15) and in Role / User (60): her limit is 15. Take her out of Finance and it becomes 60.

The lookup uses the complete set of groups a user holds, including groups they reach by implication. If Warehouse Terminal were implied by another group, a user who only has that other group is covered by the Warehouse Terminal rule too. A test covers this, because reading explicit membership alone would let a session outlive the policy that was meant to end it, which is the one direction an idle timeout must never fail in.

Priya is covered by both of these lines. The smaller number applies.

Tomas Novak works the dock terminal and also has a normal internal login for his email. He is in Warehouse Terminal (10) and Role / User (60). His limit is 10 minutes on every screen, because the rule is about the user, not about the terminal. Lena Fischer, who is only an internal user, gets 60.

The rule follows the user, not the machine. It cannot give the same person ten minutes on the dock and an hour at their desk, and it has no concept of a device.

one number per user, always the tightest of their rules, so belonging to a lenient group never buys a longer leash.

The rule has to match a group the user actually holds. A group that is only held through another group still counts, but a group the user does not have has no effect, whatever its rule says.

Session Control: 2 The shortest rule wins

3 Idle means idle: what counts, and the one-minute cost

Use it when you want to know exactly when somebody is logged out, and what keeps them from being.Writes the session, at most once a minute

Measuring idle time sounds simple until you decide what to measure. Time since login is a session lifetime, not idleness. Time since the last page load misses somebody who spends an hour in one form, saving as they go. The clock has to run from the last time the browser spoke to the server.

Before Odoo authenticates a request, the app reads a stamp stored in the session, mh_last_seen . If the user has a rule and the stamp is older than the limit, the session is ended and Odoo does the rest: the person lands on the login page, with the usual redirect back to where they were after signing in. Otherwise the stamp is renewed.

The stamp is not rewritten on every request. It is renewed only when it is more than 60 seconds old, because a session write on every request across a whole database, to save a timestamp, would cost more than the feature is worth. The consequence is stated plainly: a timeout can overrun by up to a minute. A ten minute rule ends a session between ten and eleven minutes after its last request.

A session that has no stamp yet, because it started before the rule existed, is stamped on its next request instead of being logged out. Treating a missing stamp as infinitely old would log everybody out the moment a rule was saved. The cost is that such a session gets its full allowance counted from that first request.

Where a person lands after the limit has passed: the ordinary Odoo login.

On the test database the Warehouse Terminal rule was set to the minimum, five minutes. Maya Chen and Tomas Novak, both on the rule, and Daniel Ortiz, who is not covered by it, each signed in and loaded the web client once. Maya and Daniel were then left alone. Tomas made a request every 45 seconds. After seven minutes Maya's next request was redirected to the login page. Tomas and Daniel were not.

It cannot tell a person from a script. A browser tab that polls the server on a timer, or a monitoring script holding a session open, counts as activity.

a clock that runs from the last request, not from login. We left a session alone on a 5 minute rule and it was logged out; a session on the same rule that kept making requests was not.

Every request counts, including requests a page makes by itself. A screen that keeps calling the server on a timer keeps its user signed in. This app measures requests, not whether somebody is looking at the screen.

Session Control: 3 Idle means idle: what counts, and the one-minute cost

4 Rules that refuse bad numbers

Use it when you want a number nobody can set by accident, and one rule per group so there is one number to point at.Refuses at save, writes nothing

A timeout of two minutes is a mistake that looks like a policy. People are logged out in the middle of filling in a form, lose what they typed, and the software is blamed rather than whoever chose the number. Two rules on the same group are the other classic: nobody can say which one is in force.

A rule below five minutes is refused with a message saying so and why. A second rule on a group that already has one is refused too, with a message telling you to change the existing rule so that there is one number per group. Both checks run when the line is saved, in the database, and neither leaves a half-made rule behind.

Typing 2 minutes is refused.

A second rule for the same group is refused.

An administrator adds a line for Warehouse Terminal with 2 minutes, hoping to be strict. The save is refused with the five-minute message. They type 5, which works, and put Strictest the IT audit allowed in the Why column. A week later somebody else tries to add a second Warehouse Terminal line at 20 minutes and is told to edit the first one instead.

Five minutes is a fixed floor in the code, not a setting. It checks the number, not whether the number is wise for your people: ten minutes on a screen where people fill in long forms is permitted, and will cost somebody a form.

a clear message at the moment of saving, instead of a surprise on the shop floor a week later.

Session Control: 4 Rules that refuse bad numbers
Session Control: 4 Rules that refuse bad numbers

5 Open Sessions: who is signed in right now

Use it when you want the truth about who is signed in at this moment, not a log of logins.Read-only scan of the session store

Odoo does not keep a table of logged-in users. Each session is a file on the server. A list built from login events would show sessions that ended long ago and miss the ones created another way, so a list of logins is a log, not an answer to the question who is signed in.

Open Sessions reads the session files where Odoo keeps them and shows what is open now: the user , when the session started , when it was last active , how many minutes it has been idle , and a ticked box on the row that is you . The most idle sessions are at the top. Above the list sit the number of open sessions and the time of the scan. A person with two browsers has two rows.

The session store belongs to the whole server, not to one database. Every other database on the server has its sessions in the same place, so the scan skips any session that belongs to another database. Without that, another database's sessions would show up here with user numbers resolved against the wrong database, and ending one would log out somebody else's user. A test covers it.

Last active is the time Odoo last wrote the session file, and idle is that time against the clock, in whole minutes.

Seven sessions open on the sample database, most idle first. The administrator's own row has no End button.

It is 4 p.m. and the administrator opens the list. Samuel Okafor has been idle for 125 minutes. His group's rule says 15, but nothing happens until he makes another request, so his session is still open, and this window is where you see it. Daniel Ortiz is at 38 minutes, inside the 60 minutes his rule allows. The administrator can tell at a glance which open sessions are already past their limit and just waiting for a click.

It does not show IP addresses, devices or locations, and it keeps no history: close the window and the list is gone. Only administrators can open it.

a list of exactly the sessions that exist, most idle first, with your own session marked.

The list is a snapshot taken each time you press Refresh, and it reads the session files Odoo keeps on disk by default. If your installation keeps sessions somewhere else, the list will be empty.

Session Control: 5 Open Sessions: who is signed in right now

6 End a session with one click

Use it when a user has left a session open on a machine you cannot reach, or you want somebody off right now.Deletes the session

Sometimes the answer to a security question is simply: sign that person out. Without a tool, that means finding the right file on the server, or changing somebody's password so their session no longer matches.

Every row except your own has an End button. It asks first: This logs that user out immediately. Anything they had typed and not saved is lost. On confirmation the app deletes that session, which is what being logged out means in Odoo, records in the server log who ended whose session, and rescans the list. The user's next request goes to the login page. We checked it on the test database: after Samuel Okafor's session was ended, his next request was redirected to login.

Your own row has no button at all. If an End were somehow triggered for it, the app refuses with a message saying it is the session you are using, so you cannot end the screen you are looking at by accident.

The confirmation before a session is ended.

After ending Samuel Okafor's session: six rows, his is gone.

Samuel Okafor's laptop was left open in a taxi. The administrator opens Open Sessions, sees Samuel's row at 125 minutes idle, presses End and confirms. The list now has six rows. When the laptop is next opened and clicked, it goes to the login page.

Ending a session does not disable the account or change the password: the user can sign in again. For that, change the user in Odoo as usual.

the user is signed out on their next click, and the list refreshes with that row gone.

Ending a session is immediate and loses what the person had typed and not saved. The button asks for confirmation for that reason.

Session Control: 6 End a session with one click
Session Control: 6 End a session with one click

7 Built to stay out of the way

Use it when you are being asked to put code on every request of a production database.Failures are logged and ignored

Any code on every request is code that can break every request. A timeout is not worth a database that will not answer. So the idle check runs inside a guard that catches everything it raises, writes it to the server log and carries on to Odoo's normal authentication. If the check itself ever fails, the worst case is that nobody is logged out for that request. (This comes from reading the code: we could not provoke it on a healthy database.)

The check sits before Odoo authenticates, so the logout takes the same path as any other: Odoo raises, redirects and saves the session itself.

The superuser is never logged out. Scheduled jobs and upgrade scripts run as that account and have no browser to log out. A user with no rule, an archived rule or no group named in any rule has no limit at all.

The guard hides failures from the user, so they exist only in the log. If you rely on the timeout for compliance, test it on your own database, as we did, rather than assuming it.

Who it is for

The Odoo administrator who has been told that the shared terminals must sign out after ten minutes, and wants it enforced and written down in one place.

The IT lead or consultant who sets up several databases and wants the policy to be a list of three or four lines with reasons, not a code change.

Whoever answers the auditor : the rule list shows, per group, the number and the reason, and the Open Sessions window shows the policy at work.

It is not for end users, who never see it, and it is not a login history, an IP restriction or a two-factor tool.

What this app does not do

It ends a session after inactivity. It does not warn before it does, does not save the person's work and does not offer to stay signed in.

Every authenticated request counts as activity. Background requests made by a page keep its user signed in, so it measures requests, not attention.

The timeout can overrun by up to a minute, because the last-seen stamp is written at most once a minute per session.

A session started before a rule existed gets its full allowance counted from its first request after the rule, not from its real last activity.

The superuser is never logged out. Users with no rule are never logged out by this app.

The Open Sessions list reads the session files Odoo keeps on disk by default. It is a snapshot, it does not record history and it does not show IP addresses or devices. Last active is the time of the last session write, which is close to, but not exactly, the stamp the timeout uses.

Other internal users cannot open the menu, but they hold read access to the rule records themselves, so a user who queries the database through Odoo's API can read the minutes and the notes. Do not put anything in a note you would not show them.

Questions buyers ask

Is this the same as Odoo's Auth Timeout?

No. Reading Odoo's Auth Timeout code, its inactivity timer asks the person to confirm their identity and the session stays valid. Session Control ends the session itself. They can run side by side.

When exactly is somebody logged out?

On their first request after the limit has passed. The request goes to the login page. If the person has not touched the screen, nothing happens until they do.

Does a page that refreshes itself keep a user signed in?

Yes. Any request counts as activity, whoever or whatever makes it.

What if a user is in several groups with different rules?

The shortest limit applies.

Can I set a timeout under five minutes?

No. Anything under five minutes is refused when you save.

Will it log out the administrator account that runs my scheduled jobs?

No. The superuser is never logged out.

Does the list show sessions of my other databases?

No. Only sessions belonging to the database you are in.

Can it slow down my server?

It adds one small rule lookup to each request from a signed-in user and rewrites the session at most once a minute. It does not write on every request. If its check fails it is logged and ignored.

Requirements

  • Odoo 19.0 or 20.0. The App Store sells each version separately, so buy the one that matches your database.
  • Odoo.sh or On-Premise only. Third-party apps cannot be installed on Odoo Online (SaaS) databases. Check your hosting before buying.
  • Module mh_session_control, version 19.0.1.0.22, licensed OPL-1.