| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
from odoo import models, _ |
| 5 |
from odoo.exceptions import UserError |
| 6 |
|
| 7 |
|
| 8 |
class HrApplicant(models.Model): |
| 9 |
_inherit = 'hr.applicant' |
| 10 |
|
| 11 |
def website_form_input_filter(self, request, values): |
| 12 |
if values.get('job_id'): |
| 13 |
job = self.env['hr.job'].browse(values.get('job_id')) |
| 14 |
if not job.sudo().active: |
| 15 |
raise UserError(_("The job offer has been closed.")) |
| 16 |
stage = self.env['hr.recruitment.stage'].sudo().search([ |
| 17 |
('fold', '=', False), |
| 18 |
'|', ('job_ids', '=', False), ('job_ids', '=', values['job_id']), |
| 19 |
], order='sequence asc', limit=1) |
| 20 |
if stage: |
| 21 |
values['stage_id'] = stage.id |
| 22 |
return values |