From daeab8929ef4073917d851e47a3396db6cf81b99 Mon Sep 17 00:00:00 2001 From: Ivan Yelizariev Date: Fri, 5 Feb 2021 11:55:52 +0000 Subject: [PATCH] [IMP] stock: use optimization on searching by qty_available Such requests could be done via Products list and there is no reason to don't use optimization --- opw-2452728 https://github.com/odoo/odoo/commit/9daf3f85a8a3b012a79226fe13d3cde2293fcce0 closes odoo/odoo#66987 X-original-commit: b7e7029829915581056f3d79a36e3c2f60cc02f2 Signed-off-by: Arnold Moyaux --- addons/stock/models/product.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/models/product.py b/addons/stock/models/product.py index 515f0fcfa64..29e501def45 100644 --- a/addons/stock/models/product.py +++ b/addons/stock/models/product.py @@ -313,7 +313,7 @@ class Product(models.Model): # to use the quants, not the stock moves. Therefore, we bypass the usual # '_search_product_quantity' method and call '_search_qty_available_new' instead. This # allows better performances. - if value == 0.0 and operator == '>' and not ({'from_date', 'to_date'} & set(self.env.context.keys())): + if not ({'from_date', 'to_date'} & set(self.env.context.keys())): product_ids = self._search_qty_available_new( operator, value, self.env.context.get('lot_id'), self.env.context.get('owner_id'), self.env.context.get('package_id')