From 5eba1ff07ed5105044abb219206cf28485f77942 Mon Sep 17 00:00:00 2001 From: William Henrotin Date: Fri, 25 Nov 2022 15:58:43 +0000 Subject: [PATCH] [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 --- addons/mrp/models/stock_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/models/stock_move.py b/addons/mrp/models/stock_move.py index c2515e913e5..582ff855898 100644 --- a/addons/mrp/models/stock_move.py +++ b/addons/mrp/models/stock_move.py @@ -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(