From 5032fc16b4012eb9802fe261bc0170ac2f17749d Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Tue, 10 Sep 2019 14:30:41 +0000 Subject: [PATCH] [FIX] orm: in modified() force target search ordering by 'id' Some model can have really complex _order, which can induce unnecessary slow queries; here as we don't need the right business order we force ordering by 'id' instead OPW-2007478 closes odoo/odoo#36660 X-original-commit: a1fe8976156a7b6e14aa2d68650176a0e64ba73f Signed-off-by: Raphael Collet (rco) --- odoo/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/models.py b/odoo/models.py index 7e9da96559b..b1cbe64cd80 100644 --- a/odoo/models.py +++ b/odoo/models.py @@ -5279,7 +5279,7 @@ Fields: target0 = Model.browse(i for [i] in self.env.cr.fetchall()) else: env = self.env(user=SUPERUSER_ID, context={'active_test': False}) - target0 = env[model_name].search([(path, 'in', self.ids)]) + target0 = env[model_name].search([(path, 'in', self.ids)], order='id') target0 = target0.with_env(self.env) # prepare recomputation for each field on linked records for field in stored: