From d77cc252bb21c5a1af631e353ab5d0cc78dafc0d Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Tue, 19 May 2026 00:21:53 -0400 Subject: [PATCH] =?UTF-8?q?fix(tests):=20TestReceivingGate=20=E2=80=94=20d?= =?UTF-8?q?rop=20nonexistent=20step=5Fkind=5Fid,=20use=20step=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- .../tests/test_fp_job_milestone_cascade.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/fusion_plating/fusion_plating_jobs/tests/test_fp_job_milestone_cascade.py b/fusion_plating/fusion_plating_jobs/tests/test_fp_job_milestone_cascade.py index 719d6b48..aaf28e9d 100644 --- a/fusion_plating/fusion_plating_jobs/tests/test_fp_job_milestone_cascade.py +++ b/fusion_plating/fusion_plating_jobs/tests/test_fp_job_milestone_cascade.py @@ -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