class ir_http(orm.AbstractModel):
_inherit = 'ir.http'
- def get_utm_domain_cookies(slef):
+ def get_utm_domain_cookies(self):
return request.httprequest.host
def _dispatch(self):
'/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>',
], type='http', auth="public", website=True)
- def jobs(self, country=None, department=None, office_id=None):
+ 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))
Country = env['res.country']
if country_code:
countries_ = Country.search([('code', '=', country_code)])
country = countries_[0] if countries_ else None
+ if not any(j for j in jobs if j.address_id and j.address_id.country_id == country):
+ country = False
# Filter the matching one
- if country:
+ if country and not kwargs.get('all_countries'):
jobs = (j for j in jobs if j.address_id is None or j.address_id.country_id and j.address_id.country_id.id == country.id)
if department:
jobs = (j for j in jobs if j.department_id and j.department_id.id == department.id)
<template id="job_countries" inherit_id="website_hr_recruitment.index" active="False" customize_show="True" name="Filter by Countries">
<xpath expr="//div[@id='jobs_grid_left']" position="inside">
<ul class="nav nav-pills nav-stacked mb32">
- <li t-att-class=" '' if country_id else 'active' "><a t-attf-href="/jobs#{ '/department/%s' % slug(department_id) if department_id else '' }#{ '/office/%s' % office_id if office_id else '' }">All Countries</a></li>
+ <li t-att-class=" '' if country_id else 'active' "><a t-attf-href="/jobs#{ '/country/all/department/%s' % slug(department_id) if department_id else '' }#{ '/office/%s' % office_id if office_id else '' }?all_country=1">All Countries</a></li>
<t t-foreach="countries" t-as="country">
<li t-att-class="'active' if country_id and country_id.id == country.id else ''">
<a t-attf-href="/jobs/country/#{ slug(country) }#{ '/department/%s' % slug(department_id) if department_id else '' }#{ '/office/%s' % office_id if office_id else '' }" ><span t-field="country.name"/></a>