From 4f3f28ada3be6263c121753ce58b976bf3921b36 Mon Sep 17 00:00:00 2001 From: wan Date: Fri, 26 Feb 2021 13:31:36 +0000 Subject: [PATCH] [IMP] account: add index used to open the dashboard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes odoo/odoo#82807 X-original-commit: 18f03ef60153f593346738cfc09aaf755ba8d761 Signed-off-by: William André (wan) --- addons/account/models/account_move.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index f622050b201..b72d2b69aa8 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -49,6 +49,14 @@ class AccountMove(models.Model): _check_company_auto = True _sequence_index = "journal_id" + def init(self): + self.env.cr.execute(""" + CREATE INDEX IF NOT EXISTS account_move_to_check_idx + ON account_move(journal_id) WHERE to_check = true; + CREATE INDEX IF NOT EXISTS account_move_payment_idx + ON account_move(journal_id, state, payment_state, move_type, date); + """) + @property def _sequence_monthly_regex(self): return self.journal_id.sequence_override_regex or super()._sequence_monthly_regex