From 362bb6cba1958a5ac702ff7b73153b37d5699f17 Mon Sep 17 00:00:00 2001 From: KNVx Date: Tue, 22 Nov 2022 16:36:45 +0100 Subject: [PATCH] [FIX] account_asset_management: Poor performance updating assets massively When updating assets massively the performance when searching for deprecation_lines_ids is very low. It is a difficult problem to detect since massive asset updates are not common. Indexing in this field dramatically improves the timing performance. For example, to update 3000 records it took 30 sec. With this index it takes to 2 seconds. --- account_asset_management/models/account_asset_line.py | 1 + account_asset_management/readme/CONTRIBUTORS.rst | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/account_asset_management/models/account_asset_line.py b/account_asset_management/models/account_asset_line.py index e51e6a35f..02e756d5a 100644 --- a/account_asset_management/models/account_asset_line.py +++ b/account_asset_management/models/account_asset_line.py @@ -19,6 +19,7 @@ class AccountAssetLine(models.Model): required=True, ondelete="cascade", check_company=True, + index=True, ) previous_id = fields.Many2one( comodel_name="account.asset.line", diff --git a/account_asset_management/readme/CONTRIBUTORS.rst b/account_asset_management/readme/CONTRIBUTORS.rst index 99153bcc4..3237ae2ed 100644 --- a/account_asset_management/readme/CONTRIBUTORS.rst +++ b/account_asset_management/readme/CONTRIBUTORS.rst @@ -20,3 +20,7 @@ * Jordi Ballester * Miquel Raïch + +* `NuoBiT `_: + + * Kilian Niubo