fix(tests): TestReceivingGate — drop nonexistent step_kind_id, use step name

The helper set step_kind_id on fp.job.step when fp.step.kind model
exists, but step_kind_id field doesn't actually exist on fp.job.step
in deployed shape — both test_start_skips_contract_review and
test_finish_skips_contract_review erred with
  ValueError: Invalid field 'step_kind_id' in 'fp.job.step'

Per CLAUDE.md rule 18, _fp_is_contract_review_step() matches step
name case-insensitive against 'contract review' or 'qa-005'. The
test only needs to trigger that detection — set name='Contract
Review' on the CR branch and let the receiving gate's existing
exemption fire.

All 8 TestReceivingGate tests now pass on entech.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-05-19 00:21:53 -04:00
parent 091f98e1f9
commit d77cc252bb

View File

@@ -797,19 +797,15 @@ class TestReceivingGate(TransactionCase):
'qty': 1.0,
'sale_order_id': so.id,
})
# _fp_is_contract_review_step() matches case-insensitive name
# against "contract review" / "qa-005" OR recipe_node_id default_kind.
# Setting name='Contract Review' is the simplest reliable trigger
# and matches how operators tag the step in production.
step_vals = {
'job_id': job.id,
'name': 'Plate',
'name': 'Contract Review' if is_cr else 'Plate',
'state': step_state,
}
# If a step_kind model is available, set CR vs not via kind.
StepKind = self.env.get('fp.step.kind')
if StepKind is not None and is_cr:
cr_kind = StepKind.search(
[('code', '=', 'contract_review')], limit=1,
)
if cr_kind:
step_vals['step_kind_id'] = cr_kind.id
step = self.env['fp.job.step'].create(step_vals)
return job, step