open_workshop/post_init_hook.py

21 lines
684 B
Python

# -*- coding: utf-8 -*-
from odoo import SUPERUSER_ID
from odoo.api import Environment
import logging
_logger = logging.getLogger(__name__)
def run_migration(cr, registry):
"""
Wird nach der Modulinstallation automatisch ausgeführt.
Migriert vorhandene res.partner-Einträge zu ows.user.
"""
env = Environment(cr, SUPERUSER_ID, {})
_logger.info("[OWS] Starte automatische Partner-Migration bei Modulinstallation...")
try:
env['res.partner'].migrate_existing_partners()
_logger.info("[OWS] Automatische Partner-Migration abgeschlossen.")
except Exception as e:
_logger.error(f"[OWS] Fehler bei automatischer Migration: {e}")