diff --git a/itou/job_applications/models.py b/itou/job_applications/models.py index ef7172c1a40..18ad1734b14 100644 --- a/itou/job_applications/models.py +++ b/itou/job_applications/models.py @@ -987,6 +987,7 @@ def unset_processed_at(self, *args, **kwargs): @before_transition( JobApplicationWorkflow.TRANSITION_PROCESS, JobApplicationWorkflow.TRANSITION_POSTPONE, + JobApplicationWorkflow.TRANSITION_ACCEPT, JobApplicationWorkflow.TRANSITION_MOVE_TO_PRIOR_TO_HIRE, JobApplicationWorkflow.TRANSITION_CANCEL_PRIOR_TO_HIRE, JobApplicationWorkflow.TRANSITION_REFUSE, diff --git a/tests/job_applications/tests.py b/tests/job_applications/tests.py index 3f1575c7be4..e51672ff88e 100644 --- a/tests/job_applications/tests.py +++ b/tests/job_applications/tests.py @@ -1721,6 +1721,21 @@ def test_job_application_transition_unarchives(transition, from_state): assert job_application.archived_at is None +@pytest.mark.parametrize( + "transition_name,from_state", + [ + (JobApplicationWorkflow.TRANSITION_ACCEPT, JobApplicationState.ACCEPTED), + (JobApplicationWorkflow.TRANSITION_MOVE_TO_PRIOR_TO_HIRE, JobApplicationState.PRIOR_TO_HIRE), + ], +) +def test_unarchive_job_application(transition_name, from_state): + job_application = JobApplicationFactory(state=JobApplicationState.PROCESSING, archived_at=timezone.now()) + user = job_application.to_company.members.get() + getattr(job_application, transition_name)(user=user) + job_application.refresh_from_db() + assert job_application.archived_at is None + + class JobApplicationXlsxExportTest(TestCase): def test_xlsx_export_contains_the_necessary_info(self, *args, **kwargs): create_test_romes_and_appellations(["M1805"], appellations_per_rome=2)