# -*- coding: utf-8 -*-
from odoo import api, SUPERUSER_ID


def post_init_hook(cr, registry):
    """Recompute stored V2 fields on existing timesheet lines."""
    env = api.Environment(cr, SUPERUSER_ID, {})
    lines = env['account.analytic.line'].search([('project_id', '!=', False)])
    if lines:
        lines._compute_amount()
        lines._compute_is_internal()
