OdooWiki OCA HUB

Dynamic groups

auth_dynamic_groups folder_open OCA/server-auth open_in_new
Tools License: AGPL-3

This module allows defining groups whose membership is a condition expressed as python code. For every user, it is evaluated during login if she belongs to the group or not.

auto_awesome What this module does

AI-generated from the code · Odoo 14.0

Lets you define groups whose members are chosen automatically by a condition written in Python, evaluated each time a user logs in.

This module adds two fields to the group form in Settings: a "Dynamic" checkbox and a "Condition" text box. When you tick Dynamic, the manual user list becomes read-only and you must fill in a condition. The condition is Python code evaluated at login time, with the user record available as user, so you can write rules such as checking a department, a company or any other field on the user.

  • On every login (except the superuser), Odoo removes the user from all dynamic groups and re-adds them to the ones whose condition is true.
  • A button "Evaluate" on the group form re-runs the conditions for all existing users immediately, so you do not have to wait for each user to log in.
  • If the condition contains a syntax or name error, Odoo refuses to save the group and shows a validation message.

The module touches res.groups (the group definition) and res.users (login and membership update). It only changes the group form view; no new menu is added. Membership is stored in the standard group/user relation, so all normal Odoo access rights based on that group apply as usual.

Depends on

base
Models and fields (2)
  • res.users · extends an existing model
  • res.groups · extends an existing modelis_dynamic (Dynamic), dynamic_group_condition (Condition)

Text generated by AI (DeepSeek) from reading the Odoo 14.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub

Availability by version

Reviewed: 2026-11-03
Confirmed (verified in repository and branch) Estimated (unverified) No information

Confirmation status: 1 confirmed, 8 with no information of 9 versions.

Sources · Odoo 14.0

Confirmed on 2026-11-03 in branch 14.0 of OCA/server-auth.

terminal Installation and usage

OCA documentation · Odoo 14.0

Check Dynamic on a group you want to be dynamic. Now fill in the condition, using user which is a browse record of the user in question that evaluates truthy if the user is supposed to be a member of the group and falsy if not.

There is a constraint on the field to check for validity if this expression. When you're satisfied, click the button Evaluate to prefill the group's members. The condition will be checked now for every user who logs in.

We have a group called Amsterdam and want it to contain all users from city of Amsterdam. So we use the membership condition

user.partner_id.city == 'Amsterdam'

Now we can be sure every user living in this city is in the right group, and we can start assigning local menus to it, adjust permissions, etc. Keep in mind that view overrides can also be restricted by a group id, this gives a lot of possibilities to dynamically adapt views based on arbitrary properties reachable via the user record.

No verified information in OCA: Installation.

info

Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.