Skip to Content
Menu
This question has been flagged
3356 Zobrazenia

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
Zrušiť
Related Posts Replies Zobrazenia Aktivita
2
máj 21
2589
1
jún 22
2415
0
júl 23
2115
1
aug 22
4196
2
jún 22
4658