[FIX] website_hr_recruitment: Avoid exponential sitemap generation

Purpose
=======

Currently all the possible routes for /jobs are put in the sitemap.

Each time you create a job, you add at least 250 links in the sitmap (The country can be set on the route)

Specification
=============

This commit backports the behavior of this commit in v11.0 (https://github.com/odoo/odoo/commit/1b52b00d2aa96b9360d50a0f0960f1febb5e607e)

Don't generate sitemap entries for other routes than /jobs/
This commit is contained in:
Yannick Tivisse
2017-10-12 12:10:52 +02:00
parent acb4689827
commit eb7a098592
@@ -6,16 +6,17 @@ from odoo.addons.website.models.website import slug
from odoo.http import request
# NB: DO NOT FORWARD PORT THE FALSY LEAVES IN 11.0
class WebsiteHrRecruitment(http.Controller):
@http.route([
'/jobs',
'/jobs/country/<model("res.country"):country>',
'/jobs/department/<model("hr.department"):department>',
'/jobs/country/<model("res.country"):country>/department/<model("hr.department"):department>',
'''/jobs/country/<model("res.country", "[(0, '=', 1)]"):country>''',
'''/jobs/department/<model("hr.department", "[(0, '=', 1)]"):department>''',
'''/jobs/country/<model("res.country"):country>/department/<model("hr.department", "[(0, '=', 1)]"):department>''',
'/jobs/office/<int:office_id>',
'/jobs/country/<model("res.country"):country>/office/<int:office_id>',
'/jobs/department/<model("hr.department"):department>/office/<int:office_id>',
'/jobs/country/<model("res.country"):country>/department/<model("hr.department"):department>/office/<int:office_id>',
'''/jobs/country/<model("res.country", "[(0, '=', 1)]"):country>/office/<int:office_id>''',
'''/jobs/department/<model("hr.department", "[(0, '=', 1)]"):department>/office/<int:office_id>''',
'''/jobs/country/<model("res.country"):country>/department/<model("hr.department", "[(0, '=', 1)]"):department>/office/<int:office_id>''',
], type='http', auth="public", website=True)
def jobs(self, country=None, department=None, office_id=None, **kwargs):
env = request.env(context=dict(request.env.context, show_address=True, no_tag_br=True))