[FIX] account: performance of account selector side bar
Adding a domain on the accounts before doing the lateral join helps reducing the amount of lateral queries needed to be done, most of which would return an empty subset. Since an empty subset on a query with limit=1 means that we need to scan the whole table, it can have a huge impact. closes odoo/odoo#111415 X-original-commit: 10a5e494aa5f9328e97052289ac829aad5f80c86 Signed-off-by: Fabien Pinckaers <fp@odoo.com> Signed-off-by: William André (wan) <wan@odoo.com>
This commit is contained in:
@@ -1567,7 +1567,8 @@ class AccountMoveLine(models.Model):
|
||||
SELECT account.root_id
|
||||
FROM account_account account,
|
||||
LATERAL ({query_str}) line
|
||||
""", query_param)
|
||||
WHERE account.company_id IN %s
|
||||
""", query_param + [tuple(self.env.companies.ids)])
|
||||
return {
|
||||
root.id: {'id': root.id, 'display_name': root.display_name}
|
||||
for root in self.env['account.root'].browse(id for [id] in self.env.cr.fetchall())
|
||||
|
||||
Reference in New Issue
Block a user