From c50b198f27d4377b9ca6bf6422c3a5fbaafdcbab Mon Sep 17 00:00:00 2001 From: Joan Sisquella Date: Thu, 20 Aug 2020 11:31:18 +0200 Subject: [PATCH] [IMP] domain widget performance fix --- account_financial_report/models/account_move_line.py | 8 ++++++++ .../wizard/general_ledger_wizard_view.xml | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/account_financial_report/models/account_move_line.py b/account_financial_report/models/account_move_line.py index 70e921e1..6efe6db1 100644 --- a/account_financial_report/models/account_move_line.py +++ b/account_financial_report/models/account_move_line.py @@ -28,3 +28,11 @@ class AccountMoveLine(models.Model): self._cr.execute(""" CREATE INDEX account_move_line_account_id_partner_id_index ON account_move_line (account_id, partner_id)""") + + @api.model + def search_count(self, args): + # In Big DataBase every time you change the domain widget this method + # takes a lot of time. This improves performance + if self.env.context.get("skip_search_count"): + return 0 + return super(AccountMoveLine, self).search_count(args) diff --git a/account_financial_report/wizard/general_ledger_wizard_view.xml b/account_financial_report/wizard/general_ledger_wizard_view.xml index 60b73c99..ad325a77 100644 --- a/account_financial_report/wizard/general_ledger_wizard_view.xml +++ b/account_financial_report/wizard/general_ledger_wizard_view.xml @@ -71,7 +71,8 @@ - + +