From 7706e153c6ca93f48793dc581034515de438c22e 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 | 10 +++++++++- .../wizard/general_ledger_wizard_view.xml | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/account_financial_report/models/account_move_line.py b/account_financial_report/models/account_move_line.py index 4558a323..dd07af0a 100644 --- a/account_financial_report/models/account_move_line.py +++ b/account_financial_report/models/account_move_line.py @@ -1,6 +1,6 @@ # Copyright 2019 ACSONE SA/NV () # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).- -from odoo import models +from odoo import api, models class AccountMoveLine(models.Model): @@ -30,3 +30,11 @@ class AccountMoveLine(models.Model): 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 9b7c68db..342df21d 100644 --- a/account_financial_report/wizard/general_ledger_wizard_view.xml +++ b/account_financial_report/wizard/general_ledger_wizard_view.xml @@ -94,10 +94,13 @@ /> +