[IMP] improved kanban and form views lp:~openerp-dev/openobject-addons/trunk-job-positions-improve-cod

bzr revid: tpa@tinyerp.com-20130906055234-r7l7uc34o4o64icc
This commit is contained in:
Turkesh Patel (Open ERP) 2013-09-06 11:22:34 +05:30
commit 191e7513c0
6 changed files with 51 additions and 27 deletions

View File

@ -347,7 +347,7 @@
<label string="Job Name" class="oe_edit_only" colspan="4"/>
<h1><field name="name" class="oe_inline" nolabel="1" colspan="2"/></h1>
</div>
<div class="oe_right oe_job_button_box" name="buttons"/>
<div class="oe_right" name="buttons"/>
<group>
<group name="job_data">
<field name="department_id"/>

View File

@ -73,6 +73,3 @@
width: auto;
float: none;
}
.openerp .oe_job_button_box {
width: 24%;
}

View File

@ -463,6 +463,12 @@ class hr_job(osv.osv):
for applicant in applicant_obj.browse(cr, uid, applicant_ids, context=context):
res[applicant.job_id.id] += 1
return res
def _get_attached_docs(self, cr, uid, ids, field_name, arg, context=None):
"""Calculate total attached CV per job"""
attachment_obj = self.pool.get('ir.attachment')
res = {id: attachment_obj.search(cr, uid, [('res_model', '=', 'hr.job'), ('res_id', '=', id)], count=True, context=context) for id in ids}
return res
_columns = {
'survey_id': fields.many2one('survey', 'Interview Form', help="Choose an interview form for this job position and you will be able to print/answer this interview from all applicants who apply for this job"),
@ -471,6 +477,7 @@ class hr_job(osv.osv):
"create new applicants for this job position."),
'application_count': fields.function(_application_count, type='integer', string="Total Applications"),
'manager_id': fields.related('department_id', 'manager_id', type='many2one', string='Department Manager', relation='hr.employee', readonly=True, store=True),
'doc_count':fields.function(_get_attached_docs, string="Number of documents attached", type='int')
}
def _auto_init(self, cr, context=None):
@ -510,6 +517,20 @@ class hr_job(osv.osv):
'nodestroy': True,
}
def attachment_tree_view(self, cr, uid, ids, context):
domain = ['&', ('res_model', '=', 'hr.job'), ('res_id', 'in', ids)]
res_id = ids and ids[0] or False
return {
'name': _('Attachments'),
'domain': domain,
'res_model': 'ir.attachment',
'type': 'ir.actions.act_window',
'view_id': False,
'view_mode': 'tree,form',
'view_type': 'form',
'limit': 80,
'context': "{'default_res_model': '%s','default_res_id': %d}" % (self._name, res_id)
}
class applicant_category(osv.osv):
""" Category of applicant """

View File

@ -338,24 +338,22 @@
<label for="survey_id" groups="base.group_user"/>
<div groups="base.group_user">
<field name="survey_id" class="oe_inline" domain="[('type','=','Human Resources')]"/>
<button string="Print Interview" name="action_print_survey" type="object" attrs="{'invisible':[('survey_id','=',False)]}" class="oe_inline oe_link"/>
</div>
</group>
<xpath expr="//group[@name='job_data']" position="after">
<group name="group_alias"
attrs="{'invisible': [('alias_domain', '=', False)]}">
<label for="alias_name" string="Email Alias"/>
<div name="alias_def">
<xpath expr="//field[@name='department_id']" position="after">
<label for="alias_name" string="Email Alias" attrs="{'invisible': [('alias_domain', '=', False)]}"/>
<div name="alias_def" attrs="{'invisible': [('alias_domain', '=', False)]}">
<field name="alias_id" class="oe_read_only oe_inline"
string="Email Alias" required="0"/>
<div class="oe_edit_only oe_inline" name="edit_alias" style="display: inline;" >
<field name="alias_name" class="oe_inline"/>@<field name="alias_domain" class="oe_inline" readonly="1"/>
</div>
</div>
</group>
</xpath>
<div name="buttons" position="inside">
<button string="Applications" name="%(action_hr_job_applications)d" type="action"/>
<button string="Interview" name="action_print_survey" type="object" attrs="{'invisible':[('survey_id','=',False)]}"/>
<button name="attachment_tree_view" string="Documents" type="object"/>
</div>
</field>
</record>
@ -401,15 +399,15 @@
<div class="oe_job oe_name oe_kanban_ellipsis">
<field name="name"/>
</div>
<div class="oe_job_alias oe_kanban_ellipsis" t-if=" record.alias_id.value and record.state.raw_value == 'recruit'">
<span class="oe_e">%%</span><small><field name="alias_id"/></small>
</div>
<div class="oe_job oe_department">
<field name="department_id"/>
<span t-if="record.manager_id.value" class="oe_manager_name">
(<t t-esc="record.manager_id.value"/>)
</span>
</div>
<div class="oe_job_alias oe_kanban_ellipsis" t-if=" record.alias_id.value and record.state.raw_value == 'recruit'">
<span class="oe_e">%%</span><small><field name="alias_id"/></small>
</div>
</div>
<t t-if="record.state.raw_value == 'recruit'">
@ -418,20 +416,25 @@
<span t-if="record.application_count.value gt 1"><field name="application_count"/> Applications</span>
<span t-if="record.application_count.value lt 2"><field name="application_count"/> Application</span>
</a>
<br/>
<a t-if="record.doc_count.raw_value" name="attachment_tree_view" type="object">
<span t-if="record.doc_count.raw_value gt 1"><field name="doc_count"/> Documents</span>
<span t-if="record.doc_count.raw_value lt 2"><field name="doc_count"/> Document</span>
</a>
</div>
<field state="recruit" name="no_of_recruitment" widget="justgage" options="{'label_field': 'no_of_hired_employee', 'action_change': 'action_employee_to_hire'}">Forecast</field>
</t>
<t t-if="record.state.raw_value == 'open'">
<div class="oe_start_recruitment">
<p>To start the recruitment, <b>click here</b></p>
<p><b>click here</b>, To start the recruitment</p>
<img src="/hr_recruitment/static/src/img/down1.png"/>
</div>
</t>
<div class="oe_launch_recruitment">
<a t-if="record.survey_id.raw_value" data-name="action_print_survey" data-type="object" class="oe_kanban_action">Print Interview</a>
<a t-if="record.survey_id.raw_value"> | </a>
<a t-if="record.state.raw_value == 'open'" data-name="job_recruitment" data-type="object" class="oe_kanban_action">Launch Recruitment</a>
<a t-if="record.state.raw_value == 'recruit'" data-name="job_open" data-type="object" class="oe_kanban_action">Recruitment Done</a>
<a t-if="record.survey_id.raw_value"> | </a>
<a t-if="record.survey_id.raw_value" data-name="action_print_survey" data-type="object" class="oe_kanban_action">Print Interview</a>
</div>
<div class="oe_kanban_footer_left oe_job_messages">
<t t-raw="record.message_summary.raw_value"/>
@ -453,7 +456,10 @@
<field name="context">{'search_default_in_recruitment': 1}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
"Click here to create a new job" or remove the filter on "In Recruitment". Define job position profile and manage all your recruitment in a context of a particular job: print interview survey, define number of expected new employees, and manage its recruitment pipe
Click here to create a new job or remove the filter on "On Recruitment" to recruit for an on hold job.
</p>
<p>
Define job position profile and manage recruitment in a context of a particular job: print interview survey, define number of expected new employees, and manage its recruitment pipe
</p>
</field>
</record>

View File

@ -33,10 +33,10 @@
margin-top: -5px;
}
.openerp .oe_launch_recruitment{
float: right;
float: left;
position: absolute;
bottom: 3px;
right: 10px;
left: 10px;
}
.openerp div.oe_applications {
position: absolute;;
@ -63,7 +63,6 @@
height:130px;
}
.openerp .oe_department {
height: 44px !important;
width: 358px;
overflow: hidden;
text-overflow: ellipsis;
@ -74,19 +73,20 @@
color: #4c4c4c;
}
.openerp .oe_start_recruitment {
padding-top: 22px;
padding-top: 10px;
}
.openerp .oe_start_recruitment p {
font-size: 14px;
color: gray;
padding-left: 50px;
}
.openerp .oe_start_recruitment img {
margin-top: -24px;
margin-top: -22px;
width: 32px;
height: 32px;
float: right;
padding-right: 88px;
height: 34px;
float: left;
padding-left: 12px;
}
.openerp .oe_job_messages{
margin-top: 40px !important;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB