[FIX] website_hr_recruitment: sort jobs / departments by name
The jobs / departments / offices were not in alphabetical order but ordered by the job they were in, which didn't make sense. task-3278949 closes odoo/odoo#119260 X-original-commit: 5da763a8ef0503286fa5cc55e32970f4d785825a Signed-off-by: Kevin Baptiste <kba@odoo.com>
This commit is contained in:
@@ -52,15 +52,13 @@ class WebsiteHrRecruitment(http.Controller):
|
||||
|
||||
# Filter job / office for country
|
||||
if country and not kwargs.get('all_countries'):
|
||||
jobs = [j for j in jobs if not j.address_id or j.address_id.country_id.id == country.id]
|
||||
offices = set(j.address_id for j in jobs if not j.address_id or j.address_id.country_id.id == country.id)
|
||||
else:
|
||||
offices = set(j.address_id for j in jobs if j.address_id)
|
||||
jobs = jobs.filtered(lambda j: not j.address_id or j.address_id.country_id.id == country.id)
|
||||
offices = jobs.address_id.sorted(lambda a: (a.country_id.name or '', a.city or ''))
|
||||
|
||||
# Deduce departments and countries offices of those jobs
|
||||
departments = set(j.department_id for j in jobs if j.department_id)
|
||||
countries = set(o.country_id for o in offices if o.country_id)
|
||||
employment_types = set(j.contract_type_id for j in jobs if j.contract_type_id)
|
||||
departments = jobs.department_id.sorted('name')
|
||||
countries = offices.country_id.sorted('name')
|
||||
employment_types = jobs.contract_type_id.sorted('name')
|
||||
|
||||
if department:
|
||||
jobs = [j for j in jobs if j.department_id and j.department_id.id == department.id]
|
||||
|
||||
Reference in New Issue
Block a user