Skip to Content
Menu
This question has been flagged
2254 Views

Hi, I wanna link the job application form in Odoo 14, with the job's survey questions so that the applicant can fill out the survey questions during the job application.

I have tried to add the survey question to the job application form but it cannot work because the applicant must submit the job application in the db first so that I can associate the survey with the applicant.

My goal: I want the applicant to fill out the job application and then redirect them to the survey questions on the website and send the acknowledgment email to the applicant.

Any help will be greatly appreciated.


from odoo import http, _
from odoo.addons.http_routing.models.ir_http import slug
from odoo.http import request
from werkzeug.exceptions import NotFound
from odoo.addons.website_hr_recruitment.controllers.main import WebsiteHrRecruitment


class WebsiteHrRecruitmentInherit(WebsiteHrRecruitment):
@http.route([
'/jobs',
'/jobs/country/',
'/jobs/department/',
'/jobs/country//department/',
'/jobs/office/',
'/jobs/country//office/',
'/jobs/department//office/',
'/jobs/country//department//office/',
], type='http', auth="public", website=True, sitemap=sitemap_jobs)


def jobs(self, country=None, department=None, office_id=None, **kwargs):
survey_id = request.env['hr.applicant'].sudo().search([])
res = super(WebsiteHrRecruitmentInherit, self).jobs(self, country=None, department=None, office_id=None, **kwargs)
# print("Inherited ....", res)
return res()
# return http.request.render('hr_recruitment.survey', {'survey_id: survey_id'})

@http.route('''/jobs/apply/''', type='http', auth="public", website=True, sitemap=True)
def jobs_apply(self, job, **kwargs):
# survey_id = request.env['hr.job'].sudo().search([])
if not job.can_access_from_current_website():
raise NotFound()

for rec in self:
ctx = {}
ctx['email_to'] = rec.partner_id.email
ctx['email_from'] = self.env.user.user_id.email
ctx['send_email'] = True
ctx['partner_id'] = rec.partner_id.id
template = self.env.ref('hr_recruitment_custom.acknowledgment_email_template')
template.with_context(ctx).send_mail(
rec.id, force_send=True, raise_exception=False)

error = {}
default = {}
if 'website_hr_recruitment_error' in request.session:
error = request.session.pop('website_hr_recruitment_error')
default = request.session.pop('website_hr_recruitment_default')

return request.render("website_hr_recruitment.apply", {
'job': job,
'error': error,
'default': default,
# 'survey_id': survey_id,
})


Avatar
Discard
Related Posts Replies Views Activity
2
May 21
1691
1
Jun 22
1400
0
Jul 23
1017
1
Aug 22
2299
2
Jun 22
3185