feat(jobs): Sub 14 polish — workflow state form layout + Simple Editor field

Two follow-ups on the workflow state work:

1) Form layout
   The "How triggers combine" help text was crammed into a 2-column
   group, taking ~25% of the available width. Pulled it out of the
   group and rendered as a full-width <div class="alert alert-info">
   below the trigger fields. Same fix applied to Notes — uses a
   <separator> + bare <field> for full sheet width.

2) Simple Recipe Editor support
   The trigger field was only exposed in the Tree Editor. Added it
   to the Simple Editor's inline library form too:

   * fp.step.template.triggers_workflow_state_id (new Many2one) —
     per-template default, snapshot-copied to recipe nodes when
     dropped into a recipe (added to _SNAPSHOT_FIELDS).
   * /fp/simple_recipe/workflow_states/list — new endpoint to feed
     the dropdown. Soft-fails when fusion_plating_jobs isn't
     installed (returns []).
   * Library editor JS — _fpEnsureWorkflowStatesLoaded helper
     caches the catalog on first open (create + edit paths both
     warm it). Save vals carry the trigger id.
   * Library editor XML — dropdown rendered after the flag
     checkboxes. Hidden when the catalog is empty so the form
     doesn't show a useless "— None —" pick.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-05-04 00:04:59 -04:00
parent 28bf6b5071
commit e54ffe7309
7 changed files with 157 additions and 19 deletions

View File

@@ -79,6 +79,22 @@ class FpStepTemplate(models.Model):
'earlier-sequence steps are still in progress (e.g. '
'paperwork that runs alongside production).',
)
# Sub 14 — workflow milestone trigger (optional)
# The fp.job.workflow.state model lives in fusion_plating_jobs, so
# this Many2one resolves at runtime only when that module is loaded.
# When the library template is dropped into a recipe, the value is
# snapshot-copied to the new process_node via _SNAPSHOT_FIELDS in
# simple_recipe_controller.py.
triggers_workflow_state_id = fields.Many2one(
'fp.job.workflow.state',
string='Triggers Workflow State',
ondelete='set null',
help='Sub 14. When a recipe step generated from this template '
'finishes (or is skipped/cancelled), the parent job '
'advances to this workflow state. Leave blank to fall '
'back to default-kind matching defined on the workflow '
'state catalog.',
)
requires_rack_assignment = fields.Boolean(string='Requires Rack Assignment',
help='Triggers Rack Parts sub-dialog at runtime (Sub 12b).')
requires_transition_form = fields.Boolean(string='Requires Transition Form',