From d5ea45c06e35dfbe46bb816cf1a1adc00b3cf23b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Voet=20=28ryv=29?= Date: Fri, 4 Dec 2020 16:26:02 +0000 Subject: [PATCH] [FIX] stock: add index on `lot_id` of `stock.quant` For validate 5K stock move line with SN: Without index: 200 sec of SQL execution With index: 15 of SQL execution opw-2374846 X-original-commit: 21d7afca292f4c213d1fcfb4a31e0b7157eb941c --- addons/stock/models/stock_quant.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/models/stock_quant.py b/addons/stock/models/stock_quant.py index bc84c5a8d46..bc093d4a9d3 100644 --- a/addons/stock/models/stock_quant.py +++ b/addons/stock/models/stock_quant.py @@ -66,7 +66,7 @@ class StockQuant(models.Model): domain=lambda self: self._domain_location_id(), auto_join=True, ondelete='restrict', readonly=True, required=True, index=True, check_company=True) lot_id = fields.Many2one( - 'stock.production.lot', 'Lot/Serial Number', + 'stock.production.lot', 'Lot/Serial Number', index=True, ondelete='restrict', readonly=True, check_company=True, domain=lambda self: self._domain_lot_id()) package_id = fields.Many2one(