Skip to content

[15.0][PERF] base_sequence_option: filter options by company in SQL - #3733

Open
Pani-k-folk wants to merge 1 commit into
OCA:15.0from
ecosoft-odoo:15.0-perf-base_sequence_option-filter_option_multi_company
Open

Pani-k-folk wants to merge 1 commit into
OCA:15.0from
ecosoft-odoo:15.0-perf-base_sequence_option-filter_option_multi_company

Conversation

@Pani-k-folk

@Pani-k-folk Pani-k-folk commented Sep 18, 2026

Copy link
Copy Markdown

Benchmarks

When each company has its own sequences, get_sequence(record) called without
options (as sale_order_sequence_option, purchase_order_sequence_option,
hr_expense_sequence_option or account_sequence_option._constrains_date_sequence do)
loaded the options of all companies and filtered them in Python, so its cost grew with
the total number of option lines. The company is now filtered in SQL.

10 companies, get_sequence(record) on 100 journal entries (10 per company), time per
record:

Option lines (per company / total) Before After
200 / 2,000 19.8 ms 10.3 ms
500 / 5,000 43.8 ms 25.1 ms
1,000 / 10,000 99.9 ms 49.2 ms

The remaining cost is the evaluation of each filter_domain of the record's company,
which is unchanged. Same sequence returned for every record. get_model_options() keeps
its signature, company is an optional argument.

@OCA-git-bot

Copy link
Copy Markdown
Contributor

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

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

Labels

mod:base_sequence_option Module base_sequence_option series:15.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants