fix(jobs): workflow state — chatter + field cycle fix + force view reload

Three issues from user testing on entech:

1. RPC error: column fp_step_template.triggers_workflow_state_id
   does not exist
   Root cause: the field was declared in fusion_plating CORE, but
   its target model fp.job.workflow.state lives in fusion_plating_jobs.
   Odoo loads core BEFORE jobs (jobs depends on core), so when core's
   field declaration runs, the comodel doesn't exist yet — and Odoo
   silently skips creating the column.
   Fix: moved the field to fusion_plating_jobs/models/fp_job.py via
   _inherit. Now the column is added when jobs loads (after core),
   and the FK target is resolvable.

2. No chatter on the Workflow State form
   Added _inherit = ['mail.thread', 'mail.activity.mixin'] to
   fp.job.workflow.state. Tracking enabled on name/code/sequence so
   admins see who changed the milestone vocabulary. <chatter/> widget
   added to the form view.

3. Form layout still showed cramped 2-col help text
   The XML file on disk had my new alert-info card, but Odoo's DB
   ir_ui_view still held the old arch. The -u didn't refresh it
   (likely because the file's mtime didn't change between deploys).
   Fix: bump version + the next deploy will run a SQL DELETE on the
   ir_ui_view record so Odoo recreates it from XML on -u.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-05-04 00:11:17 -04:00
parent e54ffe7309
commit d6bd43b76e
5 changed files with 36 additions and 17 deletions

View File

@@ -79,22 +79,10 @@ 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.',
)
# Sub 14 — triggers_workflow_state_id is declared via _inherit in
# fusion_plating_jobs/models/fp_job.py. It can't live here because
# the target model (fp.job.workflow.state) is defined in jobs, and
# core can't depend on jobs (cyclic dependency).
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',