Links to users and company consistency
A link to res.users is checked against that user’s allowed companies
(company_ids) when it is a stored many-to-many relation to res.company.
The user’s company_id selects its default company and does not override the
allowed-company scope. Other models keep ADR 0044’s usual field precedence.
If the allowed-company field is absent, the usual shape-based selection applies.
This correction changes registry metadata used by existing consistency checks, related-field company bounds and search-domain construction. It does not add a constraint ensuring that the default company belongs to the allowed companies.
Reading users is company-restricted through the same field: res.users declares
direct(field = "company_ids", branch = "exact", empty = "deny", escape = "share").
An internal user (share = false) is visible to every restricted user; a portal or
public user is visible when one of its allowed companies is an active company of
the reader (exactly: a parent or branch company is not enough). A reader whose
active-company set is empty sees no user, internal users and itself included
(SPEC-SEC-071), as for every company-scoped model. The user’s contact follows the
same idea through res.partner.partner_share (see
company consistency).
See the slice note (docs/design/m3-company-users-scope.md, not part of the published documentation) and
company consistency.
Links to a model whose company comes by delegation
Section titled “Links to a model whose company comes by delegation”Some models have no company field of their own. They get company_id from a parent through
_inherits delegation: a product variant reads its company from its product template. The registry
records that delegation, but the model stays without a company scope of its own. Record rules, related
fields and grouping keep treating it as a model without company, and its access is declared on the
model itself (product.product declares parent(edge = "product_tmpl_id")).
A link to such a model is checked only when it declares check_company = true, as stock.lot’s
product_id does. The check compares the linking record’s company with the parent’s company, read
through the delegation. A change to the parent’s company made earlier in the same transaction counts.
The match is the parent’s (exact unless the parent declares parent_of). A link that declares
nothing is not checked: the usual default (ADR 0044 rule 2) does not yet reach these links.
Three declarations are refused. The registry refuses the first two at build, with an error that names the delegate field and the parent model:
check_company = truetoward a model whosecompany_idscome by delegation. A company list read through a delegation is not supported.check_company = trueon a field of the delegating model itself, andcheck_company_auto = trueon it. That would need the delegating record’s own company read through the delegation. Declare the check on the parent model instead.- At run time, a company-dependent field with
check_company = truetoward such a model is refused with aProgrammingerror.
A later change of the parent’s company does not re-check links that already exist. The same holds for
a model with its own company_id. The rule is ADR 0044 amendment A2
(docs/adr/0044-company-consistency-by-default.md); the case is SPEC-CRUD-067.