[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
This commit is contained in:
Rémy Voet (ryv)
2020-12-23 16:08:01 +00:00
parent f21362ff2c
commit d5ea45c06e
+1 -1
View File
@@ -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(