feat(fusion_clock): planning -> native data migration [A8]
post-migrate(19.0.5.0.0) -> fusion.clock.schedule._fclk_port_planning_data: planning.role -> fusion.clock.role, employee default/allowed roles, and planning.slot -> fusion.clock.schedule (local date+float, role map, posted if published, open if unassigned). Guarded (no-op on Community), idempotent (marker), per-row savepoints. Integration test runs on Enterprise clones. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
33
fusion_clock/migrations/19.0.5.0.0/post-migrate.py
Normal file
33
fusion_clock/migrations/19.0.5.0.0/post-migrate.py
Normal file
@@ -0,0 +1,33 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2026 Nexa Systems Inc.
|
||||
# License OPL-1 (Odoo Proprietary License v1.0)
|
||||
#
|
||||
# One-time port of Odoo Enterprise Planning data into the native Fusion Clock
|
||||
# models, so a deployment that previously used the `planning` bridge keeps all
|
||||
# its roles, employee role assignments and shifts after `planning` /
|
||||
# `fusion_planning` are removed.
|
||||
#
|
||||
# Guarded: a no-op on Community / fresh installs where planning data is absent.
|
||||
# Idempotent: a marker param stops it re-running.
|
||||
|
||||
import logging
|
||||
|
||||
from odoo import api, SUPERUSER_ID
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
_MARKER = 'fusion_clock.planning_migrated'
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
"""Port Odoo Planning data into the native models, once. The heavy lifting
|
||||
lives in fusion.clock.schedule._fclk_port_planning_data so it can be unit
|
||||
tested on an Enterprise clone where planning is installed."""
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
ICP = env['ir.config_parameter'].sudo()
|
||||
if ICP.get_param(_MARKER):
|
||||
_logger.info("Fusion Clock: planning data already migrated; skipping.")
|
||||
return
|
||||
counts = env['fusion.clock.schedule'].sudo()._fclk_port_planning_data()
|
||||
ICP.set_param(_MARKER, '1')
|
||||
_logger.info("Fusion Clock: planning -> native migration done: %s", counts)
|
||||
Reference in New Issue
Block a user