addons14/sale_timesheet_rounded/hooks.py
def pre_init_hook(cr):
    """Initialize the value of the given column for existing rows in a fast way."""
    _logger.info(
        "Initializing column `unit_amount_rounded` with the " "value of `unit_amount`"
    )
    table = sql.Identifier("account_analytic_line")
    column = sql.Identifier("unit_amount_rounded")
    cr.execute(  # pylint: disable=E8103
        sql.SQL("ALTER TABLE {} ADD COLUMN IF NOT EXISTS {} NUMERIC").format(
            table, column
        )
    )
    cr.execute(  # pylint: disable=E8103
        sql.SQL(
            "UPDATE {table} SET {column} = unit_amount WHERE {column} IS NULL"
        ).format(table=table, column=column),
    )
Initialize the value of the given column for existing rows in a fast way.
Initialize the value of the given column for existing rows in a fast way.
Initialize the value of the given column for existing rows in a fast way .
def pre_init_hook(cr):
    _logger.info(
        "Initializing column `unit_amount_rounded` with the " "value of `unit_amount`"
    )
    table = sql.Identifier("account_analytic_line")
    column = sql.Identifier("unit_amount_rounded")
    cr.execute(  
        sql.SQL("ALTER TABLE {} ADD COLUMN IF NOT EXISTS {} NUMERIC").format(
            table, column
        )
    )
    cr.execute(  
        sql.SQL(
            "UPDATE {table} SET {column} = unit_amount WHERE {column} IS NULL"
        ).format(table=table, column=column),
    )
def pre_init_hook ( cr ) : _logger . info ( "Initializing column `unit_amount_rounded` with the " "value of `unit_amount`" ) table = sql . Identifier ( "account_analytic_line" ) column = sql . Identifier ( "unit_amount_rounded" ) cr . execute ( sql . SQL ( "ALTER TABLE {} ADD COLUMN IF NOT EXISTS {} NUMERIC" ) . format ( table , column ) ) cr . execute ( sql . SQL ( "UPDATE {table} SET {column} = unit_amount WHERE {column} IS NULL" ) . format ( table = table , column = column ) , )
Initialize the value of the given column for existing rows in a fast way.
Initialize the value of the given column for existing rows in a fast way .
"""Initialize the value of the given column for existing rows in a fast way.""" # pylint: disable=E8103 # pylint: disable=E8103
cr