[IMP] Improved code as per the main branch.

>Added write_date.

bzr revid: psa@tinyerp.com-20130814120706-fyok833ekmhnmfhh
This commit is contained in:
Paramjit Singh Sahota 2013-08-14 17:37:06 +05:30
parent 3a73cc94d2
commit 153c8290fc
3 changed files with 20 additions and 30 deletions

View File

@ -1 +1,2 @@
import controllers
import recruitment

View File

@ -35,11 +35,10 @@ class website_hr_recruitment(http.Controller):
if job_id:
values['job_id'] = hr_job_obj.browse(request.cr, request.uid, job_id)
html = website.render("website_hr_recruitment.jobs", values)
return html
return website.render("website_hr_recruitment.index", values)
@http.route(['/jobs/subscribe'], type='http', auth="public")
def subscribe(self, mail_group_id=None, **post):
def subscribe(self, mail_group_id=None, job_id=None, **post):
website = request.registry['website']
partner_obj = request.registry['res.partner']
group_obj = request.registry['mail.group']
@ -55,10 +54,10 @@ class website_hr_recruitment(http.Controller):
group_obj.check_access_rule(request.cr, request.uid, [mail_group_id], 'read')
group_obj.message_subscribe(request.cr, SUPERUSER_ID, [mail_group_id], partner_ids)
return self.jobs(mail_group_id=mail_group_id, subscribe=post.get('email'))
return self.jobs(mail_group_id=mail_group_id, job_id=job_id, subscribe=post.get('email'))
@http.route(['/jobs/unsubscribe'], type='http', auth="public")
def unsubscribe(self, mail_group_id=None, **post):
def unsubscribe(self, mail_group_id=None, job_id=None, **post):
website = request.registry['website']
partner_obj = request.registry['res.partner']
group_obj = request.registry['mail.group']
@ -72,7 +71,7 @@ class website_hr_recruitment(http.Controller):
group_obj.check_access_rule(request.cr, request.uid, [mail_group_id], 'read')
group_obj.message_unsubscribe(request.cr, SUPERUSER_ID, [mail_group_id], partner_ids)
return self.jobs(mail_group_id=mail_group_id, subscribe=None)
return self.jobs(mail_group_id=mail_group_id, job_id=job_id, subscribe=None)
@http.route(['/job/detail/<id>'], type='http', auth="public")
def detail(self, id=0):
@ -81,8 +80,7 @@ class website_hr_recruitment(http.Controller):
values = website.get_rendering_context({
'job': request.registry['hr.job'].browse(request.cr, request.uid, id)
})
html = website.render("website_hr_recruitment.detail", values)
return html
return website.render("website_hr_recruitment.detail", values)
@http.route(['/job/success'], type='http', auth="admin")
def success(self, **post):
@ -101,6 +99,5 @@ class website_hr_recruitment(http.Controller):
values = website.get_rendering_context({
'jobid': post['job_id']
})
html = website.render("website_hr_recruitment.thankyou", values)
return html
return website.render("website_hr_recruitment.thankyou", values)
# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,19 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="footer_website_hr_recruitment" model="ir.ui.view">
<field name="name">footer_website_hr_recruitment</field>
<field name="inherit_id" ref="website.footer"/>
<field name="arch" type="xml">
<data>
<xpath expr="//a[@href='/page/website.contactus']" position="after">
<li><a href="/jobs">Jobs</a></li>
</xpath>
</data>
</field>
</record>
<template id="job_footer_custom" inherit_id="website.layout" name="Custom Footer Job">
<xpath expr="//body/footer//h5[@name='info_title']" position="after">
<a href="/jobs">Jobs</a>
</xpath>
</template>
<template id="jobs">
<template id="index" name="Jobs">
<t t-call="website.layout">
<t t-set="title">Jobs</t>
<div class="container">
@ -36,13 +30,12 @@
<tr t-if="job.company_id.id==company.id">
<td>
<a t-att-href="'/job/detail/%%s' %% job.id"><span class="lead" t-field="job.name"/></a><br/>
<b><span t-if="job.department_id" t-esc="job.department_id.name"/></b><br/>
<span><t t-if="int(job.no_of_recruitment) &gt; 0"><b>No of Position:</b> <t t-esc="int(job.no_of_recruitment)"/></t><t t-if="int(job.no_of_recruitment) &lt; 1"><b>Right now no recruitment is going on.</b></t></span><br/><br/>
<span t-esc="job.write_date"/>
<span><t t-if="int(job.no_of_recruitment) &gt; 0"><b>Location:</b> <t t-esc="res_company.city+','"/> <t t-esc="res_company.state_id.name+','"/> <t t-esc="res_company.country_id.name"/><br/>
<span t-if="job.department_id" t-esc="job.department_id.name"/><br/>
<i class="icon-time"></i> <span t-esc="job.write_date"/><br/>
<span><t t-if="job.no_of_recruitment &gt; 0">No of Position: <t t-esc="job.no_of_recruitment"/></t><t t-if="job.no_of_recruitment &lt; 1">Right now no recruitment is going on.</t></span><br/>
<span><t t-if="job.no_of_recruitment &gt; 0">Location: <t t-esc="res_company.city+','"/> <t t-esc="res_company.state_id.name+','"/> <t t-esc="res_company.country_id.name"/><br/>
&amp;#x2706; <t t-esc="res_company.phone"/></t></span>
<div t-if="int(job.no_of_recruitment) &lt; 1">
<div t-if="job.no_of_recruitment &lt; 1">
<strong>You may also be interested in our others job positions, for which we don't have availabilities right now.<br/>
Follow the positions that interests you and we will send you an email when the position is available.</strong><br/><br/>
<form action="/jobs/subscribe" method="POST" class="form-inline span8" t-if="not subscribe">
@ -60,8 +53,7 @@
</div>
</td>
<td>
<button type="submit" class="btn label-important js_publish pull-right" name="publish">Publish</button>
<button type="submit" class="btn label label-success js_unpublish hidden" name="unpublish">Unpublish</button>
<!-- <t t-call="website.publish"><t t-set="object" t-value="job_id"/></t> -->
</td>
</tr>
</t>