[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) <sig@openerp.com>
Co-authored-by: simongoffin <sig@odoo.com>
This commit is contained in:
Swapnesh Shah
2021-04-29 08:55:13 +00:00
committed by Goffin Simon
co-authored by simongoffin
parent 45710b17da
commit f48ae97c2c
@@ -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()