[FIX] website_hr_recruitment: apply for an unpublished job internally
Issue:
------
Since the commit [^1], it was no longer possible to apply for a job
via the website if it is unpublished.
This made it impossible to apply for internal job offers.
Solution:
---------
Since the commit [^2], it is possible to distinguish
between unpublished and archived job offers.
The behavior after this commit is as follows:
- if the job is published --> everybody can apply;
- if the job is not published --> everybody can apply but the job page is hidden;
We need to know it, i.e. for internal use only.
- if the job is archived --> nobody can apply;
There is an error message "the job offer has been closed".
[^1]: https://github.com/odoo/odoo/commit/72072263ae01a8bea01c7fead000159ae9d060d2
[^2]: https://github.com/odoo/odoo/commit/6c5f38ae37e9c1014bfa93dd82ffc6a3b31f0bd5
opw-3508043
closes odoo/odoo#135791
X-original-commit: abb3afc0c46dd13e0ef8b10ae80d6534a938b3ad
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
Signed-off-by: Thomas Lefebvre (thle) <thle@odoo.com>
This commit is contained in:
@@ -770,7 +770,7 @@ msgstr ""
|
||||
#. odoo-python
|
||||
#: code:addons/website_hr_recruitment/models/hr_recruitment.py:0
|
||||
#, python-format
|
||||
msgid "You cannot apply for this job."
|
||||
msgid "The job offer has been closed."
|
||||
msgstr ""
|
||||
|
||||
#. module: website_hr_recruitment
|
||||
|
||||
@@ -16,8 +16,8 @@ class Applicant(models.Model):
|
||||
values.setdefault('name', name)
|
||||
if values.get('job_id'):
|
||||
job = self.env['hr.job'].browse(values.get('job_id'))
|
||||
if not job.sudo().website_published:
|
||||
raise UserError(_("You cannot apply for this job."))
|
||||
if not job.sudo().active:
|
||||
raise UserError(_("The job offer has been closed."))
|
||||
stage = self.env['hr.recruitment.stage'].sudo().search([
|
||||
('fold', '=', False),
|
||||
'|', ('job_ids', '=', False), ('job_ids', '=', values['job_id']),
|
||||
|
||||
Reference in New Issue
Block a user