Skip to content

Investigate active company IDs in context #18

@marcfargas

Description

@marcfargas

Summary

Investigate how Odoo's multi-company context works and how to properly handle allowed_company_ids in the client.

Background

Odoo uses allowed_company_ids in the context to determine the active companies for the current session. Important distinction:

  • allowed_company_ids = companies the user wants to see (selected in UI)
  • NOT the same as companies the user can access (which may be more)

The variable name is misleading - it's more like "active_company_ids" or "selected_company_ids".

This affects:

  • Which records are shown by default
  • Default company for new records
  • Which company's settings/sequences apply

Questions to investigate

  1. How does allowed_company_ids filter results in search and searchRead?
  2. How to determine which companies the user actually has access to?
  3. How to switch active companies mid-session via API?
  4. What's the relationship with company_id vs company_ids fields on records?

Acceptance criteria

  • Document the behavior in a new skill file (base/multi-company.md)
  • Add examples for common multi-company patterns
  • Consider if client needs a setActiveCompanies() helper

🤖 Identified by Pi (pi-mono)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions