Skip to content

[18.0][ADD] product_supplierinfo_active_products_performance_filter - #3137

Open
StephaneMangin wants to merge 1 commit into
OCA:18.0from
acsone:18.0-product_supplierinfo_active_products_performance_filter-smn
Open

[18.0][ADD] product_supplierinfo_active_products_performance_filter#3137
StephaneMangin wants to merge 1 commit into
OCA:18.0from
acsone:18.0-product_supplierinfo_active_products_performance_filter-smn

Conversation

@StephaneMangin

Copy link
Copy Markdown

Summary

Adds a new module product_supplierinfo_active_products_performance_filter that
fixes a severe performance regression on the Active Products search filter in
Purchase → Configuration → Vendor Pricelists.

Fixes upstream issue: odoo/odoo#106058

Problem

The standard Active Products filter uses the domain:

['|', ('product_tmpl_id.active', '=', True), ('product_id.active', '=', True)]

On databases with millions of products, PostgreSQL cannot satisfy this with an
index on product.supplierinfo (no local active column) and falls back to a
full-table scan — causing queries that run for more than 10 minutes.

Solution

Denormalizes product.active onto product.supplierinfo as a stored, indexed
boolean field is_product_active. The filter domain becomes:

[('is_product_active', '=', True)]

The field is kept in sync via ORM hooks on product.template and
product.product. A post_init_hook backfills existing rows on install using
direct SQL for performance.

@OCA-git-bot OCA-git-bot added series:18.0 mod:product_supplierinfo_active_products_per f8b60 Module product_supplierinfo_active_products_performance_filter labels Jul 28, 2026
@StephaneMangin
StephaneMangin force-pushed the 18.0-product_supplierinfo_active_products_performance_filter-smn branch 3 times, most recently from c6d1695 to 672cc51 Compare July 28, 2026 09:53
@StephaneMangin
StephaneMangin force-pushed the 18.0-product_supplierinfo_active_products_performance_filter-smn branch from 672cc51 to 82c55d6 Compare July 28, 2026 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:product_supplierinfo_active_products_per f8b60 Module product_supplierinfo_active_products_performance_filter series:18.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants