From 2e8dcad0618b8c6fa3ba653e6bda3a1850a7325e Mon Sep 17 00:00:00 2001 From: William Henrotin Date: Mon, 28 Nov 2022 16:38:23 +0000 Subject: [PATCH] [FIX] stock: domain optimization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 'State' field on stock move is indexed. Some domains on stock move state are expressed like (state, not in, ('a', 'b', 'c')) instead of (state, in, ('d', 'e', 'f', NULL)). The 'not in' domain won't the index and thus will be relatively slower closes odoo/odoo#109201 X-original-commit: 96f8321e894a9b7284cca8f201e5a2877b0b3a76 Signed-off-by: Rémy Voet Signed-off-by: William Henrotin (whe) --- addons/stock/report/report_stock_forecasted.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/stock/report/report_stock_forecasted.py b/addons/stock/report/report_stock_forecasted.py index ec81f864fe3..d3f0995ffe4 100644 --- a/addons/stock/report/report_stock_forecasted.py +++ b/addons/stock/report/report_stock_forecasted.py @@ -39,8 +39,8 @@ class ReplenishmentReport(models.AbstractModel): def _move_confirmed_domain(self, product_template_ids, product_variant_ids, wh_location_ids): in_domain, out_domain = self._move_domain(product_template_ids, product_variant_ids, wh_location_ids) - out_domain += [('state', 'not in', ['draft', 'cancel', 'done'])] - in_domain += [('state', 'not in', ['draft', 'cancel', 'done'])] + out_domain += [('state', 'in', ['waiting', 'assigned', 'confirmed', 'partially_available'])] + in_domain += [('state', 'in', ['waiting', 'assigned', 'confirmed', 'partially_available'])] return in_domain, out_domain def _compute_draft_quantity_count(self, product_template_ids, product_variant_ids, wh_location_ids):