[18.0][FIX] mis_builder: fix multi-company account display#782
[18.0][FIX] mis_builder: fix multi-company account display#782dnplkndll wants to merge 1 commit into
Conversation
|
Hi @sbidoul, |
|
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. |
1d780b5 to
9ef9acc
Compare
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
9ef9acc to
dbef4ee
Compare
|
Hi @sbidoul — cleaned this up per your 2026-03-27 review:
Re. "the .github/workflows part" — I went back through the branch history and don't see any 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. |
Summary
Fixes multi-company MIS report issues in Odoo 18:
company_id→company_ids:account.account.company_idwas replaced bycompany_ids(Many2many) in Odoo 18._get_account_namecrashed on multi-company reports.False account codes:
account.codeis now company-dependent (stored incode_storejsonb). When viewing a report from a different company context, codes displayed as "False". Fix useswith_company()to read codes from the account's owning company.query_companiesthreading: Passes company context throughKpiMatrixandprepare_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):
Report Configuration
Comparison Mode enabled, Year to Date period with actuals from Journal Items:
Single Company Reference (Demo Data)
Standard single-company view for reference — Demo Expenses report with budget columns:
Files changed
mis_builder/models/kpimatrix.py— acceptquery_companiesin KpiMatrixmis_builder/models/mis_report.py— threadquery_companiesthroughprepare_kpi_matrix()mis_builder/models/mis_report_instance.py— usewith_company()for account name resolutionmis_builder/tests/test_mis_report_instance.py— multi-company test casesNotes
Closes #779