[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 <amoyaux@users.noreply.github.com>
This commit is contained in:
Ivan Yelizariev
2021-03-01 10:25:21 +00:00
parent 6b849369c0
commit daeab8929e
+1 -1
View File
@@ -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')