Skip to content

Commit

Permalink
[MIG] account_tax_balance: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ramiadavid committed Nov 27, 2023
1 parent 0ccbc6f commit 5059125
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion account_tax_balance/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions account_tax_balance/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
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
important as one move can have move lines on accounts of multiple types
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 = [
Expand Down Expand Up @@ -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)
2 changes: 1 addition & 1 deletion account_tax_balance/views/account_move_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<field name="ref" position="after">
<field
name="financial_type"
attrs="{'invisible': [('move_type', 'in', ['out_invoice','in_invoice','out_refund','in_refund'])]}"
invisible="move_type in ['out_invoice','in_invoice','out_refund','in_refund']"
/>
</field>
</field>
Expand Down

0 comments on commit 5059125

Please sign in to comment.