This commit is contained in:
gsinghpal
2026-04-26 15:05:17 -04:00
parent 160198edb1
commit d9f58b9851
110 changed files with 6210 additions and 1182 deletions

View File

@@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-
# Copyright 2026 Nexa Systems Inc.
# License OPL-1
#
# Phase 1 (Sub 11) — relocate fp.work.role, fp.operator.proficiency,
# and the hr.employee shop-roles inherit from fusion_plating_bridge_mrp
# into fusion_plating core. Re-key all related ir.model.data so the
# new module owner picks up the existing records cleanly.
import logging
_logger = logging.getLogger(__name__)
def migrate(cr, version):
if not version:
return # Fresh install — nothing to migrate
patterns = [
'model_fp_work_role',
'model_fp_operator_proficiency',
'access_fp_work_role_%',
'access_fp_proficiency_%',
'view_fp_work_role_%',
'action_fp_work_role%',
'menu_fp_work_role%',
'role_%', # data records seeded by fp_work_role_data.xml
]
for pat in patterns:
cr.execute(
"""
UPDATE ir_model_data
SET module = 'fusion_plating'
WHERE module = 'fusion_plating_bridge_mrp'
AND name LIKE %s
AND NOT EXISTS (
SELECT 1 FROM ir_model_data d2
WHERE d2.module = 'fusion_plating'
AND d2.name = ir_model_data.name
)
""",
(pat,),
)
if cr.rowcount:
_logger.info(
"Sub 11: re-keyed %d row(s) for %s -> fusion_plating",
cr.rowcount, pat,
)