Monday, April 29, 2024
2 changes · 17.0
Enhancements to existing features
This update significantly improves the speed of processing large batches of serial numbers during receipt and delivery operations. By optimizing how the system searches for and manages serial numbers in inventory, processing times are reduced by 50-75% depending on the operation type. This means warehouse teams can now handle much larger shipments without experiencing system slowdowns.
Original PR description
The purpose of this PR is to be able to process a lot of serial numbers at once. In receipt and deliveries In the current situation, the number of serial already in stock has an impact on the perf…
The purpose of this PR is to be able to process a lot of serial numbers at once. In receipt and deliveries In the current situation, the number of serial already in stock has an impact on the perf (due to `update_available_quantity` that do a `_gather` on current stock). All the metrics below are made with 50 000 SN already in stock Before (in seconds): || Receipt | Delivery | |--------|--------|--------| |100| 1.63 | 34.21 | |5000| 87.04 | 242.56 | |30 000| 563.75 | T.O. | After: || Receipt | Delivery | |--------|--------|--------| |100| 0.91 | 5.62 | |5000| 47.21 | 56.28 | |30 000| 195.27 | 307.80 | By operations/ receipts (for 5000): | | action_assign | button_validate | total | |--------|--------|--------|--------| | Before patch | 5.38 | 82.02 | 87.04 | | After patch | 3.82 | 43.39 | 47.21 | By operations/ deliveries (for 5000): | | action_assign | button_validate | total | |--------|--------|--------|--------| | Before patch | 180.06 | 62.50 | 242.56 | | After patch | 20.51 |35.77 | 56.28 | The main issues: - The constraint check on quant/stock.move.line are done one by one since there is nothing done in batch, same for computed field (Not fixed here)  - The put away takes an important amount of times without any putaways rules  - The optimisation made in #116803 was a good idea but it was only use in action_assign. `_action_assign` use strict=False in `_gather` (mts case). It means a child_of operator is in the domain, and it will perform an extra query anyway - The lot_name matching to lot_id is made `stock.move.line` by `stock.move.line` on 30 000, half of the time is spent to find them.  After some testing. The quant_cache could contain too many items than needed by the current operation. Example receive 1 serial number (that will not have an existing quant) will use a quant_cache with all the serial number of the products. As a result, the group by will be super slow. Allow to add an extra domain, to limit the cache size. /!\ could be dangerous if it filter out too much  Forward-Port-Of: odoo/odoo#154619 Forward-Port-Of: odoo/odoo#146494
Resolved issues and error corrections
This fix ensures that when database constraints are removed from models in Odoo, they are properly deleted from the database tables. Previously, constraints were left behind, causing problems during system upgrades. This resolves a common source of upgrade failures.
Original PR description
Otherwise we leave the constraints in the table. Common source of upgrade issues. --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#161115