@http.route([
'/jobs',
'/jobs/department/<model("hr.department"):department>',
- '/jobs/office/<string:office>'
+ '/jobs/office/<string:office>',
+ '/jobs/country/<model("res.country"):country>'
], type='http', auth="public", website=True)
- def jobs(self, department=None, office=None):
+ def jobs(self, department=None, office=None, country=None):
context=dict(request.context, show_address=True, no_tag_br=True)
cr, uid = request.cr, request.uid
# Deduce departments and offices of those jobs
departments = set(j.department_id for j in jobs if j.department_id)
offices = set(j.address_id for j in jobs if j.address_id)
+ countries = set(o.country_id for o in offices if o.country_id)
# Filter the matching one
jobs = [j for j in jobs if department==None or j.department_id and j.department_id.id == department.id]
jobs = [j for j in jobs if office==None or j.address_id and j.address_id.id == office_id]
+ jobs = [j for j in jobs if country==None or j.address_id and j.address_id.country_id and j.address_id.country_id.id == country.id]
# Render page
return request.website.render("website_hr_recruitment.index", {
'offices': offices,
'department_id': department and department.id,
'office_id': office_id,
+ 'countries': countries
})
@http.route('/jobs/add', type='http', auth="user", methods=['POST'], website=True)
<xpath expr="//div[@id='jobs_grid_left']" position="inside">
<ul class="nav nav-pills nav-stacked mb32">
<li t-att-class=" '' if office_id else 'active' "><a href="/jobs">All Offices</a></li>
- <t t-foreach="offices" t-as="thisoffice">
- <li t-att-class=" 'active' if office_id == thisoffice.id else '' ">
- <a t-attf-href="/jobs/office/#{ slug(thisoffice) }" >
- <span t-field="thisoffice.city"/><t t-if="thisoffice.country_id">,
- <span t-field="thisoffice.country_id.name"/>
- </t>
- </a>
- </li>
- </t>
+ <li t-foreach="countries" t-as="thiscountry"><a t-attf-href="/jobs/country/#{slug(thiscountry)}" t-field="thiscountry.name"/>
+ <ul class="nav nav-pills nav-stacked nav-hierarchy">
+ <t t-foreach="offices" t-as="thisoffice">
+ <li t-if="thisoffice.country_id == thiscountry" t-att-class=" 'active' if office_id == thisoffice.id else '' ">
+ <a t-attf-href="/jobs/office/#{ slug(thisoffice) }" >
+ <span t-field="thisoffice.city"/>
+ </a>
+ </li>
+ </t>
+ </ul>
+ </li>
</ul>
</xpath>
<xpath expr="//div[@id='jobs_grid_left']" position="attributes">