Monday, June 2, 2025
1 change
Enhancements to existing features
This update speeds up processing of historical point-of-sale orders when upgrading to Odoo 18 or enabling French POS certification on an existing database. Large databases that previously spent close to an hour preparing order links can now complete the same step in about a minute, reducing upgrade downtime and deployment risk.
Original PR description
**Patch description:** - This commit addresses a perf issue in the `_compute_previous_order` compute of the `pos.order` model, which is particularly noticeable during db upgrade from `v17.0` to…
**Patch description:** - This commit addresses a perf issue in the `_compute_previous_order` compute of the `pos.order` model, which is particularly noticeable during db upgrade from `v17.0` to `v18.0` because field `previous_order_id` got introduced in `v18.0` or when installing the `l10n_fr_pos_cert` module on an existing db with many POS orders in `v18.0`. - In both cases, the compute method is triggered for all `pos.order` records to assign the `previous_order_id`, causing significant delay due to per-record lookups. **Example from a real DB with ~113k orders:** ```sql apan_2840187=> select count(*) from pos_order; count -------- 113342 (1 row) ``` **Observation:** - Before the fix (compute took nearly 50 minutes): ```py 2025-05-29 06:31:12,587 28 INFO apan_2840187_18.0 odoo.modules.registry: module l10n_fr_pos_cert: creating or updating database tables 2025-05-29 06:31:12,799 28 INFO apan_2840187_18.0 odoo.models: Prepare computation of pos.order.previous_order_id 2025-05-29 07:17:37,855 28 INFO apan_2840187_18.0 odoo.modules.loading: loading l10n_fr_pos_cert/views/pos_views.xml ``` - After the fix (completed within 1 min): ```py 2025-05-30 06:56:59,510 24 INFO apan_2840187_18.0 odoo.modules.registry: module l10n_fr_pos_cert: creating or updating database tables 2025-05-30 06:56:59,584 24 INFO apan_2840187_18.0 odoo.models: Prepare computation of pos.order.previous_order_id 2025-05-30 06:57:12,531 24 INFO apan_2840187_18.0 odoo.modules.loading: loading l10n_fr_pos_cert/views/pos_views.xml ``` **Note:** The issue reported in the OPW was not originally about perf, but it was clearly exposed during the upgrade of the mentioned db. opw-4812874 upg-2840187 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr