From 50591256558b602e86208a46e15e088f623939b0 Mon Sep 17 00:00:00 2001 From: David Ramia Date: Mon, 27 Nov 2023 07:54:12 +0100 Subject: [PATCH] [MIG] account_tax_balance: Migration to 17.0 --- account_tax_balance/__manifest__.py | 2 +- account_tax_balance/hooks.py | 8 ++++---- account_tax_balance/views/account_move_view.xml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/account_tax_balance/__manifest__.py b/account_tax_balance/__manifest__.py index e141a26ae3b5..164110e064e2 100644 --- a/account_tax_balance/__manifest__.py +++ b/account_tax_balance/__manifest__.py @@ -6,7 +6,7 @@ { "name": "Tax Balance", "summary": "Compute tax balances based on date range", - "version": "16.0.1.1.1", + "version": "17.0.1.0.0", "development_status": "Mature", "category": "Invoices & Payments", "website": "https://github.com/OCA/account-financial-reporting", diff --git a/account_tax_balance/hooks.py b/account_tax_balance/hooks.py index 6119c2881f9b..9bca9dfdf27d 100644 --- a/account_tax_balance/hooks.py +++ b/account_tax_balance/hooks.py @@ -6,7 +6,7 @@ from psycopg2 import sql -def pre_init_hook(cr): +def pre_init_hook(env): """Precreate financial_type and fill with appropriate values to prevent a MemoryError when the ORM attempts to call its compute method on a large amount of preexisting moves. Note that the order of the mapping is @@ -14,7 +14,7 @@ def pre_init_hook(cr): and the move type is set in the order of precedence.""" logger = logging.getLogger(__name__) logger.info("Add account_move.financial_type column if it does not yet exist") - cr.execute( + env.cr.execute( "ALTER TABLE account_move ADD COLUMN IF NOT EXISTS financial_type VARCHAR" ) MAPPING = [ @@ -43,5 +43,5 @@ def pre_init_hook(cr): query += sql.SQL("WHERE am.financial_type IS NULL") if extra_where: query += sql.SQL(extra_where) - cr.execute(query, tuple(args)) - logger.info("%s move set to type %s", financial_type, cr.rowcount) + env.cr.execute(query, tuple(args)) + logger.info("%s move set to type %s", financial_type, env.cr.rowcount) diff --git a/account_tax_balance/views/account_move_view.xml b/account_tax_balance/views/account_move_view.xml index 333b1cb97ad2..306cd9817a58 100644 --- a/account_tax_balance/views/account_move_view.xml +++ b/account_tax_balance/views/account_move_view.xml @@ -20,7 +20,7 @@