oca-financial/odoo-bringout-oca-account-invoicing-account_invoice_change_currency/account_invoice_change_currency/hooks.py
2025-08-29 15:43:04 +02:00

29 lines
656 B
Python

import logging
from odoo import tools
_logger = logging.getLogger(__name__)
def pre_init_hook(cr):
"""
Initializing column custom_rate on table account_move
for the improvement in performance to avoid long
duration in databases with thousand of moves
"""
_logger.info("Initializing column custom_rate on table account_move")
tools.create_column(
cr=cr,
tablename="account_move",
columnname="custom_rate",
columntype="numeric",
comment="Custom Rate",
)
cr.execute(
"""
UPDATE
account_move
SET
custom_rate = 1.0
"""
)