[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) <jol@odoo.com>
Signed-off-by: Piryns Victor (pivi) <pivi@odoo.com>
This commit is contained in:
Victor Piryns (pivi)
2024-01-24 06:39:17 +00:00
parent 013a0f6f65
commit c92bdffd16
+1 -1
View File
@@ -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",