Tuesday, June 3, 2025
1 change · saas-17.4
Enhancements to existing features
Stock replenishment rules now calculate pending quantities in batches while keeping location-specific results accurate. This should improve performance for businesses with many reorder points without changing how users work.
Original PR description
The method orderpoint._compute_qty_order_computed was batched in commit 17a2de91afc7d879f95fe8210437ff6015af5585 then reverted in commit a58b99509a45a4372aca460eba22893f3358139e because of a bug…
The method orderpoint._compute_qty_order_computed was batched in commit 17a2de91afc7d879f95fe8210437ff6015af5585 then reverted in commit a58b99509a45a4372aca460eba22893f3358139e because of a bug introduced when purchase_stock is installed. It should still be beneficial performance-wise to batch the calls to orderpoint._quantity_in_progress so this commit reintroduces the batching. The part that led to the issue was the override of _quantity_in_progress in the purchase_stock module. The first line `self.product_id._get_quantity_in_progress(self.location_id.ids)` is not correctly working when len(self) > 1. So this method is not batchable in its current state. To fix this, we inline it inside the for loop to retrieve the quantity_in_progress independently for each orderpoint in self. Thanks to that, the test introduced in 606dc7187a5 is passing even with the batched version of _compute_qty_to_order_computed. --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr