Skip to content
Permalink
Browse files

[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 #36639

X-original-commit: dd620c7
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
  • Loading branch information...
xavieralt authored and fw-bot committed Sep 5, 2019
1 parent 79386c2 commit c7bbe5f8dadd99d7ac552a0b003be8e21783d6c0
Showing with 1 addition and 1 deletion.
  1. +1 −1 odoo/models.py
@@ -4876,7 +4876,7 @@ def modified(self, fnames):
target0 = self
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:

0 comments on commit c7bbe5f

Please sign in to comment.
You can’t perform that action at this time.