fix(jobs): Received workflow milestone keys off pre-recipe receiving

The Received milestone was tied to recipe steps tagged
default_kind='receiving'. But receiving in this system is a pre-
recipe inbound logistics flow (fp.receiving model in
fusion_plating_receiving). When parts physically arrive, the flow
sets sale_order.x_fc_receiving_status to partial or received.

Changes:
  - New trigger_on_parts_received Boolean on fp.job.workflow.state.
  - _fp_is_passed_for_job branch: passes when sale_order's
    x_fc_receiving_status is in (partial, received).
  - _compute_workflow_state_id depends extended with
    sale_order_id.x_fc_receiving_status so the bar recomputes
    automatically when the receiving flow updates the SO.
  - DB seed update: Received state drops trigger_default_kinds=
    'receiving' and gains trigger_on_parts_received=True.

Verified end-to-end on entech: bar moves Confirmed → Received on
status change, regresses on rollback, accepts both 'partial' and
'received' as satisfying the milestone.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-05-12 00:34:19 -04:00
parent 8d082cd9cc
commit d6bda9740f
3 changed files with 26 additions and 1 deletions

View File

@@ -108,6 +108,8 @@ class FpJob(models.Model):
'quality_hold_count',
'delivery_id',
'delivery_id.state',
'sale_order_id',
'sale_order_id.x_fc_receiving_status',
)
def _compute_workflow_state_id(self):
WS = self.env['fp.job.workflow.state']