# -*- coding: utf-8 -*-
# Copyright 2024-2026 Nexa Systems Inc.
# License OPL-1 (Odoo Proprietary License v1.0)

from . import models
from . import wizard
from . import controllers


def _pre_init_hook(env):
    """Re-assign loaner data record ownership from fusion_claims before install.

    Prevents duplicate stock locations, sequences, and product categories
    when migrating loaner functionality from fusion_claims to this module.
    """
    env.cr.execute("""
        UPDATE ir_model_data SET module = 'fusion_loaners_management'
        WHERE module = 'fusion_claims'
          AND name IN (
              'stock_location_loaner',
              'seq_loaner_checkout',
              'product_category_loaner',
              'product_category_loaner_rollator',
              'product_category_loaner_wheelchair',
              'product_category_loaner_powerchair',
              'model_fusion_loaner_checkout',
              'model_fusion_loaner_history'
          )
    """)
