[FIX] mrp: add index on created_production_id

in sale_mrp module, the method `get_sale_order_count` get all stock move
with created_production_id = the current production order. Without
index, this request is significantly slow.

X-original-commit: 4c17020fb452f639d9395dccdd5fcefee109ed01
Part-of: odoo/odoo#109201
This commit is contained in:
William Henrotin
2023-01-06 12:29:38 +01:00
parent a6917c4630
commit 5eba1ff07e
+1 -1
View File
@@ -107,7 +107,7 @@ class StockMoveLine(models.Model):
class StockMove(models.Model):
_inherit = 'stock.move'
created_production_id = fields.Many2one('mrp.production', 'Created Production Order', check_company=True)
created_production_id = fields.Many2one('mrp.production', 'Created Production Order', check_company=True, index=True)
production_id = fields.Many2one(
'mrp.production', 'Production Order for finished products', check_company=True, index='btree_not_null')
raw_material_production_id = fields.Many2one(