fix(jobs): override_map always wins in _is_node_included + 2 wiring fixes
Three cascading bugs caused DOD-00153/WO-30061 to confirm with zero steps (and DOD-00150 to keep masking/bake even with overrides): 1. _is_node_included() in fp_job._generate_steps_from_recipe consulted the per-job override_map ONLY when node.opt_in_out was 'opt_in' or 'opt_out'. Default is 'disabled' (mandatory), so overrides on mandatory recipe nodes (Masking, De-Masking, Oven baking) were silently ignored. Fix: consult override_map FIRST — explicit per-job override always wins, regardless of node's opt_in_out value. 2. fp.direct.order.line.recipe_choice_ids didn't include the wizard's material_process recipe (Express Orders order-level recipe), so the line's process_variant_id domain rejected propagation. Added a 4th tier to the compute that pulls the order's header recipe in. 3. sale_order._fp_resolve_recipe_for_line fell back from line picker to part.default_process_id with nothing between. Added Express header recipe (self.x_fc_material_process) as a 2nd-priority fallback — catches cases where G3 propagation failed to reach the line but the SO header has the recipe set. Also fixed an unrelated G4 bug: _FP_PART_SYNC_FIELDS mapped process_variant_id → 'default_process_variant_id' which doesn't exist. Real field is 'default_process_id' (singular). Cleaned up DOD-00153/WO-30061 manually: backfilled line + job.recipe_id, regenerated steps with overrides respected. 8 steps now visible, masking/bake correctly omitted.
This commit is contained in:
@@ -1383,15 +1383,23 @@ class FpJob(models.Model):
|
||||
"""Determine if a node should be included based on
|
||||
opt-in/out logic, per-job overrides, and start-at-node
|
||||
filter.
|
||||
|
||||
Override map (per-job override rows) ALWAYS wins
|
||||
regardless of the node's opt_in_out setting. This is the
|
||||
escape hatch the Express Orders flow relies on to opt
|
||||
out of 'disabled' (mandatory) nodes like masking + bake.
|
||||
Without this, overrides on disabled nodes were silently
|
||||
ignored.
|
||||
"""
|
||||
nid = node.id
|
||||
if allowed_ids is not None and nid not in allowed_ids:
|
||||
return False
|
||||
# Explicit per-job override wins over any default behaviour.
|
||||
if nid in override_map:
|
||||
return override_map[nid]
|
||||
opt = node.opt_in_out or 'disabled'
|
||||
if opt == 'disabled':
|
||||
return True
|
||||
if nid in override_map:
|
||||
return override_map[nid]
|
||||
if opt == 'opt_in':
|
||||
return False # Default excluded
|
||||
return True # opt_out → default included
|
||||
|
||||
Reference in New Issue
Block a user