[IMP] website_hr_recruitment: rename Job URL in the recruitment

In this commit we renamed jobs/detail/job_position route
to jobs/job_position.

task-3339118

closes odoo/odoo#122460

Related: odoo/enterprise#41771
Signed-off-by: Kevin Baptiste <kba@odoo.com>
This commit is contained in:
Prakash Prajapati
2023-06-05 13:31:18 +02:00
parent 0d0ee1c40a
commit 81be16f275
3 changed files with 9 additions and 4 deletions
@@ -215,10 +215,15 @@ class WebsiteHrRecruitment(http.Controller):
job = request.env['hr.job'].with_context(rendering_bundle=True).create({
'name': _('Job Title'),
})
return f"/jobs/detail/{slug(job)}"
return f"/jobs/{slug(job)}"
@http.route('''/jobs/detail/<model("hr.job"):job>''', type='http', auth="public", website=True, sitemap=True)
def jobs_detail(self, job, **kwargs):
redirect_url = f"/jobs/{slug(job)}"
return request.redirect(redirect_url, code=301)
@http.route('''/jobs/<model("hr.job"):job>''', type='http', auth="public", website=True, sitemap=True)
def job(self, job, **kwargs):
return request.render("website_hr_recruitment.detail", {
'job': job,
'main_object': job,
@@ -66,7 +66,7 @@ class Job(models.Model):
def _compute_website_url(self):
super(Job, self)._compute_website_url()
for job in self:
job.website_url = f'/jobs/detail/{slug(job)}'
job.website_url = f'/jobs/{slug(job)}'
def set_open(self):
self.write({'website_published': False})
@@ -52,7 +52,7 @@
</t>
<div t-foreach="jobs" t-as="job" class="col-lg mb32">
<div t-attf-class="card #{not job.website_published and 'o_jobs_unpublished'}">
<a t-attf-href="/jobs/detail/#{ slug(job) }"
<a t-attf-href="/jobs/#{ slug(job) }"
t-attf-class="text-decoration-none text-reset"
draggable="false">
<div class="card-body p-4">
@@ -309,7 +309,7 @@
</div>
</section>
<section class="col-12 col-md-3 ps-5">
<a role="button" t-attf-href="/jobs/detail/#{slug(job)}" class="btn btn-outline-primary btn-lg mb16 o_apply_description_link">
<a role="button" t-attf-href="/jobs/#{slug(job)}" class="btn btn-outline-primary btn-lg mb16 o_apply_description_link">
<i class="oi oi-arrow-left"></i> Job Description
</a>
<div t-if="job.name" class="d-flex flex-column align-items-baseline">