From f48ae97c2cadcdc085d32be25be365fdbb5605ef Mon Sep 17 00:00:00 2001 From: Swapnesh Shah Date: Sun, 22 Nov 2020 17:24:28 +0000 Subject: [PATCH] [FIX] hr_recruitment: allow to restore Application Steps to reproduce the bug: - Create a Job Application without Applied Job - Refuse/Archive it. - Restore/Unarchive it Bug: - KeyError raised due to missing `False` in `default_stage` Fix: - Add `stage_id` if Applied Job is selected on the application. opw:2513147 closes odoo/odoo#70077 X-original-commit: b0dc16e44d027bf27ec501d922459bf0f1db8550 Signed-off-by: Simon Goffin (sig) Co-authored-by: simongoffin --- addons/hr_recruitment/models/hr_recruitment.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/hr_recruitment/models/hr_recruitment.py b/addons/hr_recruitment/models/hr_recruitment.py index dc63e79ade0..1535dec3eef 100644 --- a/addons/hr_recruitment/models/hr_recruitment.py +++ b/addons/hr_recruitment/models/hr_recruitment.py @@ -515,7 +515,8 @@ class Applicant(models.Model): ], order='sequence asc', limit=1).id for applicant in self: applicant.write( - {'stage_id': default_stage[applicant.job_id.id], 'refuse_reason_id': False}) + {'stage_id': applicant.job_id.id and default_stage[applicant.job_id.id], + 'refuse_reason_id': False}) def toggle_active(self): res = super(Applicant, self).toggle_active()