refactor(jobs): gate fp.job lifecycle hooks on fp_jobs_migration context
Migration script now sets context fp_jobs_migration=True before creating fp.job records. action_confirm and button_mark_done check this flag and skip side-effects (portal job creation, QC check, racking inspection, delivery, certificate, notification dispatch) when migrating. Without this, the migration would double-create portal jobs / QC checks / racking inspections — once via bridge_mrp's original create on the source MO, once via jobs module's lifecycle hook on the new fp.job mirror. With the gate, the migration script explicitly rebinds the existing dependents via x_fc_job_id. Manifest 19.0.2.0.0 → 19.0.2.1.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:
@@ -391,6 +391,12 @@ def run(env):
|
||||
return None
|
||||
|
||||
print('=== Migration starting ===')
|
||||
# The fp_jobs_migration context flag tells fp.job.action_confirm and
|
||||
# fp.job.button_mark_done to skip lifecycle side-effects (creating
|
||||
# portal jobs, QC checks, racking inspections, deliveries, certs,
|
||||
# notifications). The migration script rebinds existing records via
|
||||
# x_fc_job_id directly — so the side-effects would create duplicates.
|
||||
env = env(context=dict(env.context, fp_jobs_migration=True))
|
||||
MO = env['mrp.production']
|
||||
all_mos = MO.search([])
|
||||
print('Migrating %d MOs and their WOs...' % len(all_mos))
|
||||
|
||||
Reference in New Issue
Block a user