Skip to content

Commit

Permalink
[FIX] orm: in modified() force target search ordering by 'id'
Browse files Browse the repository at this point in the history
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#36644

X-original-commit: dd620c7
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
  • Loading branch information
rco-odoo committed Sep 10, 2019
1 parent 0fc0b74 commit a1fe897
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion odoo/models.py
Expand Up @@ -5226,7 +5226,7 @@ def modified(self, fnames):
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:
Expand Down

0 comments on commit a1fe897

Please sign in to comment.