[IMP]Added departments through inherit option id as like product categories.

bzr revid: bth@tinyerp.com-20130925092445-3ym9h1rzvncv7318
This commit is contained in:
bth-openerp 2013-09-25 14:54:45 +05:30
parent 78101abec8
commit f6f1e53145
3 changed files with 46 additions and 33 deletions

View File

@ -20,7 +20,8 @@ class website_hr_recruitment(http.Controller):
domain = [(1, '=', 1)] or [('website_published', '=', True)]
search = [("state", 'in', ['recruit', 'open'])]
domain += search
if id != 0:
domain += [('department_id','=', id)]
jobpost_ids = hr_job_obj.search(request.cr, request.uid, domain)
request.cr.execute("select distinct(com.id) from hr_job job, res_company com where com.id=job.company_id")
ids = []
@ -36,18 +37,15 @@ class website_hr_recruitment(http.Controller):
request.cr.execute("select * from hr_department")
for i in request.cr.fetchall():
department_ids.append(i[0])
if not id:
id = 1
active = id
jobids = hr_job_obj.search(request.cr, request.uid, [('department_id','=',id)])
step = 5
pager = request.website.pager(url="/jobs/", total=len(jobids), page=page, step=step, scope=5)
jobids = hr_job_obj.search(request.cr, request.uid, [('department_id','=',id)], limit=step, offset=pager['offset'])
pager = request.website.pager(url="/jobs/", total=len(jobpost_ids), page=page, step=step, scope=5)
jobpost_ids = hr_job_obj.search(request.cr, request.uid, domain, limit=step, offset=pager['offset'])
values = {
'active': active,
'companies': companies,
'res_job': hr_job_obj.browse(request.cr, request.uid, jobids),
'res_job': hr_job_obj.browse(request.cr, request.uid, jobpost_ids),
'departments': hr_department_obj.browse(request.cr, request.uid, department_ids),
'vals': vals,
'no_of_jobs': len(hr_job_obj.browse(request.cr, request.uid, jobpost_ids)),
@ -55,7 +53,6 @@ class website_hr_recruitment(http.Controller):
}
return request.website.render("website_hr_recruitment.index", values)
@website.route(['/job/detail/<id>'], type='http', auth="public")
def detail(self, id=0):
id = id and int(id) or 0

View File

@ -8,40 +8,36 @@
</record>
<template id="job_footer_custom" inherit_id="website.layout" name="Custom Footer Job">
<xpath expr="//header//ul[@id='top_menu']/li" position="before">
<li><a href="/jobs">Jobs</a></li>
</xpath>
<xpath expr="//footer//div[@name='info']/ul" position="inside">
<li><a href="/jobs">Jobs</a></li>
</xpath>
</template>
<template id="index" name="Jobs" page="True">
<template id="index" name="Departments" page="True">
<t t-call="website.layout">
<t t-set="head">
<t t-raw="head or ''"/>
</t>
<t t-set="title">Jobs</t>
<div id="wrap">
<div class="oe_structure">
<h1 class="text-center">Job Position</h1>
</div>
<div class="container">
<div class="oe_structure"/>
<div class="container oe_website_jobs">
<div class="row">
<div class="col-md-4 css_noprint" id="left_column">
<ul class="nav nav-pills nav-stacked">
<li class="nav-header">All Departments</li>
<t t-foreach="departments" t-as="department">
<li t-att-class="department.id == active and 'active' or ''">
<a t-attf-href="/department/#{ department.id }/" ><t t-field="department.name"/></a>
</li>
</t>
</ul>
</div>
<div class="col-md-8">
<t t-call="website.pager" >
<t t-set="classname">pull-left</t>
</t>
</div>
<div class="col-md-8">
<ul class="media-list">
<div class="col-md-4">
<h1>Departments</h1>
</div>
<div class="col-sm-4">
<t t-call="website.pager">
<t t-set="classname">pull-left</t>
</t>
</div>
</div>
<div class='row style_default'>
<div class="col-md-12" id="jobs_grid">
<ul class="media-list">
<li t-foreach="res_job" t-as="job" class="media" data-publish="">
<div class="media-body">
<span t-if="not job.no_of_recruitment" class="label label-default pull-right">No recruitment needed.</span>
@ -58,7 +54,7 @@
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="oe_structure"/>
@ -168,5 +164,22 @@
</section>
</t>
</template>
<template id="job_departments" inherit_option_id="website_hr_recruitment.index" name="Job Departments">
<xpath expr="//div[@id='jobs_grid']" position="before">
<div class="col-md-3">
<ul class="nav nav-pills nav-stacked mt16">
<li t-att-class=" '' if active else 'active' "><a href="/jobs">All Jobs</a></li>
<t t-foreach="departments" t-as="department">
<li t-att-class="department.id == active and 'active' or ''">
<a t-attf-href="/department/#{ department.id }/" ><t t-field="department.name"/></a>
</li>
</t>
</ul>
</div>
</xpath>
<xpath expr="//div[@id='jobs_grid']" position="attributes">
<attribute name="class">col-md-9</attribute>
</xpath>
</template>
</data>
</openerp>

View File

@ -4,6 +4,7 @@
<record id="hr.job_marketing" model="hr.job">
<field name="website_published">True</field>
<field name="no_of_recruitment">5</field>
<field name="description_website"><![CDATA[
<div class="oe_structure">
<center><strong>About the company</strong></center>
@ -47,8 +48,9 @@
]]></field>
</record>
<record id="hr.job_developer" model="hr.job">
<record id="hr.job_developer" model="hr.job">
<field name="website_published">True</field>
<field name="no_of_recruitment">5</field>
<field name="description_website"><![CDATA[
<div class="oe_structure">
<center><strong>About the company</strong></center>
@ -101,8 +103,9 @@
]]></field>
</record>
<record id="hr.job_consultant" model="hr.job">
<record id="hr.job_consultant" model="hr.job">
<field name="website_published">True</field>
<field name="no_of_recruitment">5</field>
<field name="description_website"><![CDATA[
<div class="oe_structure">
<center><strong>About the company</strong></center>