Skip to content

[18.0][FIX] mis_builder: fix multi-company account display#782

Open
dnplkndll wants to merge 1 commit into
OCA:18.0from
ledoent:18.0-fix-multicompany-accounts
Open

[18.0][FIX] mis_builder: fix multi-company account display#782
dnplkndll wants to merge 1 commit into
OCA:18.0from
ledoent:18.0-fix-multicompany-accounts

Conversation

@dnplkndll
Copy link
Copy Markdown

@dnplkndll dnplkndll commented Mar 24, 2026

Summary

Fixes multi-company MIS report issues in Odoo 18:

  1. company_idcompany_ids: account.account.company_id was replaced by company_ids (Many2many) in Odoo 18. _get_account_name crashed on multi-company reports.

  2. False account codes: account.code is now company-dependent (stored in code_store jsonb). When viewing a report from a different company context, codes displayed as "False". Fix uses with_company() to read codes from the account's owning company.

  3. query_companies threading: Passes company context through KpiMatrix and prepare_kpi_matrix() for proper multi-company resolution.

Screenshots

Multi-Company Report — Account Codes with Company Labels

Report pulls data from both companies — account codes show correctly with company name in brackets. Total of $37,000 consolidates Branch Office ($22,000) + YourCompany ($15,000):

Multi-Company Report

Report Configuration

Comparison Mode enabled, Year to Date period with actuals from Journal Items:

Config

Single Company Reference (Demo Data)

Standard single-company view for reference — Demo Expenses report with budget columns:

Single Company

Files changed

  • mis_builder/models/kpimatrix.py — accept query_companies in KpiMatrix
  • mis_builder/models/mis_report.py — thread query_companies through prepare_kpi_matrix()
  • mis_builder/models/mis_report_instance.py — use with_company() for account name resolution
  • mis_builder/tests/test_mis_report_instance.py — multi-company test cases

Notes

Closes #779

@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hi @sbidoul,
some modules you are maintaining are being modified, check this out!

@sbidoul
Copy link
Copy Markdown
Member

sbidoul commented Mar 27, 2026

Thanks, sounds interesting!

Can you do a separate PR for the migration issue, and remove the .github/workflows part?

I still need to find time to compare the various approaches to the multicompany issue.

@dnplkndll dnplkndll force-pushed the 18.0-fix-multicompany-accounts branch 8 times, most recently from 1d780b5 to 9ef9acc Compare March 28, 2026 01:10
nericervin added a commit to waikiservicios/mis-builder that referenced this pull request Apr 15, 2026
Replaces our minimal fix with the comprehensive fix from
OCA#782 by @dnplkndll:
- company_id → company_ids in account name display
- Fix "False" account codes with with_company() context
- Thread query_companies through KpiMatrix and prepare_kpi_matrix
- Multi-company test cases
Fixes multi-company MIS report issues in Odoo 18:

1. `account.account.company_id` was replaced by `company_ids` (Many2many)
   in Odoo 18. `_get_account_name` crashed on multi-company reports.

2. `account.code` is now company-dependent (stored in `code_store` jsonb).
   When viewing a report from a different company context, codes
   displayed as "False". Fix uses `with_company()` to read codes from
   the account's owning company.

3. Threads `query_companies` through `KpiMatrix` and `prepare_kpi_matrix()`
   for proper multi-company context resolution.

Closes OCA#779
@dnplkndll dnplkndll force-pushed the 18.0-fix-multicompany-accounts branch from 9ef9acc to dbef4ee Compare May 13, 2026 16:16
@dnplkndll dnplkndll changed the title [18.0][FIX] mis_builder: fix multi-company account display + migration [18.0][FIX] mis_builder: fix multi-company account display May 13, 2026
@dnplkndll
Copy link
Copy Markdown
Author

Hi @sbidoul — cleaned this up per your 2026-03-27 review:

  • Scope narrowed: PR is now just the runtime fix (kpimatrix.py, mis_report.py, mis_report_instance.py, tests). Dropped the auto-regenerated README/index.html drift and an unrelated .gitignore line.
  • Title fixed: dropped the misleading "+ migration" — this PR doesn't touch migrations.
  • Demo data split out: the multi-company demo XML + _post_demo_moves helper moved to a separate PR — coming next.

Re. "the .github/workflows part" — I went back through the branch history and don't see any .github/workflows changes vs upstream 18.0. Possible the screenshot URLs (which point to gs://ledo-pr-assets/odoo-qa/..., our internal QA bucket — nothing to do with GitHub Actions) confused things? Happy to scrub the PR body if that helps.

Forward-port for 19.0 ready in ledoent/mis-builder:19.0-mig-mis_builder on top of @Qlasta's #752 — exercised on a migrated copy of our prod DB with multi-company reports rendering cleanly. Will open that as a successor PR once this one lands.

Validated by running the migrated DB end-to-end on prod data; happy to share traces if useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[18.0][BUG] Account codes show as 'False' in auto_expand_accounts for multi-company reports

3 participants