fix(plating): self-heal work orders missing recipe/steps + repair existing

Root cause: jobs auto-created at SO confirm resolve the recipe once; if the
SO line's process variant is not set at that instant (new parts, or the
copy-from-quote path), the WO is created with no recipe and no steps, and
setting the recipe on the line afterward never propagates (idempotency
guard + no line-to-job sync).

Fix (fusion_plating_jobs 19.0.12.6.0):
- fp.job._fp_resync_recipe_from_so(): re-resolve recipe from the SO line(s)
  and build steps (mirrors action_confirm: generate, promote pending to
  ready, express overrides). Acts only on not-started jobs; idempotent.
- action_fp_resync_recipe_from_so(): "Re-sync Recipe from SO" header button.
- sale.order.line.write: when x_fc_process_variant_id changes, auto-heal the
  linked not-yet-started WO.

Verified on entech: WO-30071-01/02 healed (recipe + 8 steps each); auto-
propagation confirmed in a rolled-back transaction. Deployed in place
(fusion_plating_jobs is ahead of git); same change recorded here.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-06-05 01:14:57 -04:00
parent 88e1e5e9bb
commit a6186120b2
4 changed files with 85 additions and 1 deletions

View File

@@ -20,6 +20,14 @@
<field name="inherit_id" ref="fusion_plating.view_fp_job_form"/>
<field name="arch" type="xml">
<xpath expr="//header" position="inside">
<!-- Heal a WO that was created before the recipe was set
on the SO line: re-pull the recipe and build steps.
Hidden once steps exist or the job is terminal. -->
<button name="action_fp_resync_recipe_from_so" type="object"
string="Re-sync Recipe from SO"
class="btn-secondary"
icon="fa-refresh"
invisible="state in ('done', 'cancelled') or step_ids"/>
<!-- Phase 1 - Tablet redesign. Opens the JobWorkspace OWL
client action focused on this WO. Primary entry point
for techs before the Landing kanban (Phase 3) ships;