Skip to content

[18.0][mis_builder] AttributeError: account.account has no attribute company_id when computing multi-company report #774

@ecino

Description

@ecino

Module

mis_builder

Describe the bug

When a MIS report instance is configured with multiple companies (multi_company=True) and "Expand accounts" is enabled on a KPI, computing the report raises an AttributeError because kpimatrix.py accesses account.company_id on account.account records, but in Odoo 18 that field was replaced by company_ids (Many2many).

To Reproduce

Affected versions: 18.0.1.8.1, Odoo 18.0

Steps to reproduce the behavior:

  1. Set up a multi-company environment (at least 2 companies with their own chart of accounts).
  2. Create a MIS report with at least one KPI that has "Auto-expand accounts" enabled.
  3. Create a MIS report instance that queries multiple companies (i.e. multi_company=True is set internally via query_company_ids).
  4. Open or compute the report instance.

Expected behavior
The report renders correctly, showing account names with the company name appended in brackets, e.g. 101000 Cash [Company A].

Additional context
In Odoo 18, account.account.company_id (Many2one) was removed and replaced by account.account.company_ids (Many2many) to support accounts shared across multiple companies (see odoo/addons/account/models/account_account.py).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions