Skip to content

[ADD] mis_builder_account_code_single_company - #79

Open
petrus-v wants to merge 2 commits into
OCA:19.0from
petrus-v:19.0-add-odoo-addon-mis-builder-account-code-single-company
Open

petrus-v wants to merge 2 commits into
OCA:19.0from
petrus-v:19.0-add-odoo-addon-mis-builder-account-code-single-company

Conversation

@petrus-v

Copy link
Copy Markdown

In standard Odoo 19, account codes (code_store) are company-dependent.
For this reason, mis_builder's AccountingExpressionProcessor (AEP._done_parsing_search_accounts)
searches matching accounts by iterating over every company individually
(with_company(company)). In multi-company environments, this generates
N_companies * N_unique_domains search queries.

With account_code_single_company installed, accounts linked to a single
company store their code in code_store_single_company.
Searching accounts by code operates across companies without
being restricted to the active context company.

This module patches AccountingExpressionProcessor._done_parsing_search_accounts
to execute a single search query per unique account domain across
all targeted companies (company_ids in self.companies.ids).
This eliminates the loop over companies and reduces the query count
to N_unique_domains, significantly speeding up MIS report parsing
in multi-company setups.

@OCA-git-bot OCA-git-bot added series:19.0 mod:mis_builder_account_code_single_company Module mis_builder_account_code_single_company labels Oct 16, 2026
@petrus-v petrus-v changed the title 19.0 add odoo addon mis builder account code single company [ADD] mis_builder_account_code_single_company Oct 16, 2026
In standard Odoo 19, account codes (`code_store`) are company-dependent.
For this reason, `mis_builder`'s `AccountingExpressionProcessor` (`AEP._done_parsing_search_accounts`)
searches matching accounts by iterating over every company individually
(`with_company(company)`). In multi-company environments, this generates
`N_companies * N_unique_domains` search queries.

With `account_code_single_company` installed, accounts linked to a single
company store their code in `code_store_single_company`.
Searching accounts by code operates across companies without
being restricted to the active context company.

This module patches `AccountingExpressionProcessor._done_parsing_search_accounts`
to execute a single search query per unique account domain across
all targeted companies (`company_ids in self.companies.ids`).
This eliminates the loop over companies and reduces the query count
to `N_unique_domains`, significantly speeding up MIS report parsing
in multi-company setups.
@petrus-v
petrus-v force-pushed the 19.0-add-odoo-addon-mis-builder-account-code-single-company branch from 6a676de to 7840818 Compare October 16, 2026 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:mis_builder_account_code_single_company Module mis_builder_account_code_single_company series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants