feat(jobs): Phase 7 — migration script + legacy id fields
Adds legacy_mrp_production_id (Integer index) on fp.job and
legacy_mrp_workorder_id on fp.job.step. Used as the idempotency
key during cutover migration.
Three scripts under fusion_plating_jobs/scripts/:
- audit_pre_migration.py — counts and data-quality concerns BEFORE
- migrate_to_fp_jobs.py — copies MO->fp.job, WO->fp.job.step, time
logs, rebinds cross-refs (batches,
holds, certs, readings, portals,
inspections, deliveries). Idempotent.
- audit_post_migration.py — counts and verifies AFTER
Migration is run manually from \`odoo shell\` at cutover (not as
auto post-migration hook, for safety). README explains usage.
Tests verify the legacy id fields exist and the migration script
files are well-formed Python.
Manifest 19.0.1.9.0 -> 19.0.2.0.0.
Part of: native job model migration (spec 2026-04-25)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -48,6 +48,17 @@ class FpJob(models.Model):
|
||||
'job_id',
|
||||
string='Recipe Overrides',
|
||||
)
|
||||
# Phase 7 — migration idempotency key. Populated by
|
||||
# scripts/migrate_to_fp_jobs.py to mark a fp.job as the mirror of a
|
||||
# specific mrp.production. Used to skip already-migrated MOs on
|
||||
# subsequent runs. Cleared after the 2-week shadow period.
|
||||
legacy_mrp_production_id = fields.Integer(
|
||||
string='Legacy MRP Production ID',
|
||||
index=True,
|
||||
help='Database id of the source mrp.production record this job '
|
||||
'was migrated from. Used by the migration script for '
|
||||
'idempotency. Cleared post-cutover.',
|
||||
)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Recipe → fp.job.step generation (Task 2.4)
|
||||
@@ -485,3 +496,21 @@ class FpJob(models.Model):
|
||||
_logger.warning(
|
||||
"Job %s: failed to auto-create cert: %s", self.name, e,
|
||||
)
|
||||
|
||||
|
||||
class FpJobStep(models.Model):
|
||||
"""Phase 7 — adds the migration idempotency key on fp.job.step.
|
||||
|
||||
Populated by scripts/migrate_to_fp_jobs.py to mark a step as the
|
||||
mirror of a specific mrp.workorder. Used to skip already-migrated
|
||||
WOs on subsequent runs.
|
||||
"""
|
||||
_inherit = 'fp.job.step'
|
||||
|
||||
legacy_mrp_workorder_id = fields.Integer(
|
||||
string='Legacy MRP Work Order ID',
|
||||
index=True,
|
||||
help='Database id of the source mrp.workorder this step was '
|
||||
'migrated from. Used by the migration script for '
|
||||
'idempotency. Cleared post-cutover.',
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user