Skip to Content

[PERF] point_of_sale: invoicing an order asks the pricelist for a percentage rule

Succeed 358m open
PR
#1379
PR Author
Roy Le
Committer
Roy Le
Commit
4b8a9597dcb1
Branch
19.0
Age
Up-time
Commit message
[PERF] point_of_sale: invoicing an order asks the pricelist for a percentage rule

_prepare_invoice_lines read order.pricelist_id.item_ids to know whether the pricelist has a percentage
rule. Reading item_ids applies the field's domain on the products' active flag ("product_tmpl_id IN
(SELECT id FROM product_template WHERE active ...)", the same for the variants) to every rule of the
pricelist, and PostgreSQL scans those subqueries once per rule when the active products do not fit in
work_mem: 47 s for each invoice of a point of sale order on a pricelist of 3,597 rules with 160,000
products (0.8 s with a hashed subplan at work_mem 16 MB). df008ba5523f avoided the same read when loading
the POS data.

The question is now asked of the rules once per order: a count, limited to one, of the pricelist's
percentage rules under the same domain. PostgreSQL filters on compute_price (indexed) first and runs the
product subqueries only for the percentage rules: 0.6 ms on that pricelist, which has none. Same answer
as before; it was also recomputed for every line of the order.
Build Log
Date Level Message
12/04/2026 03:01:38 PM INFO
Running on build host office2, the most idle machine, build containers taken: office2 10/12, the master 61/36, office1 25/12
12/04/2026 03:01:38 PM INFO
Updated repository Viindoo-tvtmaaddons
12/04/2026 03:01:38 PM INFO
Updated repository Viindoo-erponline-enterprise
12/04/2026 03:01:38 PM INFO
Updated repository Viindoo-branding
12/04/2026 03:01:38 PM INFO
Cloned repository Viindoo-odoo
12/04/2026 03:01:38 PM INFO
At install tests: this pull request changes no frontend file, so it runs without /web:WebSuite.test_unit_desktop, /web:WebSuite.test_hoot, /web:WebSuite.test_qunit_desktop, /web:MobileWebSuite.test_unit_mobile, /im_livechat:ExternalTestSuite.test_external_livechat
12/04/2026 03:01:38 PM INFO
At install tests: this pull request changes nothing installed before point_of_sale, so it runs without the at install tests of the 504 modules installed before it
12/04/2026 03:01:38 PM INFO
Post install tests: this pull request changes no frontend file, so it runs without /web:WebSuite.test_unit_desktop, /web:WebSuite.test_hoot, /web:WebSuite.test_qunit_desktop, /web:MobileWebSuite.test_unit_mobile, /im_livechat:ExternalTestSuite.test_external_livechat
12/04/2026 03:01:38 PM INFO
Post install tests: 9 parallel builds balanced by the test time measured on 19.0, the longest about 171 minutes of tests
12/04/2026 03:24:15 PM INFO
Post install tests: no parallel build added, 3 builds wait to start