From c92bdffd166a600b4f94bfa9bddf81bdd87cbdb8 Mon Sep 17 00:00:00 2001 From: "Victor Piryns (pivi)" Date: Mon, 8 Jan 2024 14:25:47 +0100 Subject: [PATCH] [PERF] account: index `account_type` to speed up reports Description: Add missing index to speed up queries related to the P&L reports. As the report queries per `account_type` it's beneficial to have it indexed. The field is not write heavy, and has low count of distinct values ( since it's a selection field), so there is little downside of having it. It is meant to support the changes done in the related enterprise PR. Reference: opw-3659497 closes odoo/odoo#150775 X-original-commit: 01ec86ded9128ae9fd11d27285e64d139a0ce31b Related: odoo/enterprise#54986 Signed-off-by: John Laterre (jol) Signed-off-by: Piryns Victor (pivi) --- addons/account/models/account_account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_account.py b/addons/account/models/account_account.py index 18b5e6c58a9..22cf2b8caaf 100644 --- a/addons/account/models/account_account.py +++ b/addons/account/models/account_account.py @@ -67,7 +67,7 @@ class AccountAccount(models.Model): ], string="Type", tracking=True, required=True, - compute='_compute_account_type', store=True, readonly=False, precompute=True, + compute='_compute_account_type', store=True, readonly=False, precompute=True, index=True, help="Account Type is used for information purpose, to generate country-specific legal reports, and set the rules to close a fiscal year and generate opening entries." ) include_initial_balance = fields.Boolean(string="Bring Accounts Balance Forward",