[IMP] improve code and add field in hr configuration to add default alias prefix for the job.

bzr revid: tpa@tinyerp.com-20130523120819-o2p3ziex4ioaatil
This commit is contained in:
Turkesh Patel (Open ERP) 2013-05-23 17:38:19 +05:30
parent 4a122011bb
commit 874a27a9c0
5 changed files with 48 additions and 22 deletions

View File

@ -35,7 +35,7 @@
<group name="recruitment_grp">
<label for="id" string="Talent Management"/>
<div name="recruitment">
<div>
<div name="hr_recruitment">
<field name="module_hr_recruitment" class="oe_inline"/>
<label for="module_hr_recruitment"/>
</div>

View File

@ -537,6 +537,7 @@ class hr_job(osv.osv):
"create new applicants for this job position."),
'priority_count': fields.function(_count_priority, string='Total Priority Employees', type="char"),
'manager_id': fields.function(_get_department_mgr, string='Department Manager', type="char"),#manager image in kanban
'alias_prefix': fields.char("Alias Name Prefix For Jobs",help="Default Prefix for Alias name of jobs"),
}
_defaults = {
'alias_domain': False, # always hide alias during creation
@ -555,7 +556,7 @@ class hr_job(osv.osv):
alias_id = mail_alias.create_unique_alias(cr, uid,
# Using '+' allows using subaddressing for those who don't
# have a catchall domain setup.
{'alias_name': 'jobs+'+vals['name']},
{'alias_name': vals['alias_prefix']+'+'+vals['name']},
model_name="hr.applicant",
context=context)
vals['alias_id'] = alias_id

View File

@ -317,6 +317,7 @@
attrs="{'invisible': [('alias_domain', '=', False)]}">
<label for="alias_id" string="Email Alias"/>
<field name="alias_id" class="oe_inline oe_read_only" required="0" nolabel="1"/>
<field name="alias_prefix" invisible="1"/>
<span name="edit_alias" class="oe_edit_only">
<field name="alias_name" class="oe_inline"
attrs="{'required': [('alias_id', '!=', False)]}"/>
@ -356,35 +357,52 @@
<div class="oe_dropdown_toggle oe_dropdown_kanban">
<span class="oe_e">í</span>
<ul class="oe_dropdown_menu">
<t t-if="widget.view.is_action_enabled('edit')"><li><a type="edit">Edit...</a></li></t>
<t t-if="widget.view.is_action_enabled('delete')"><li><a type="delete">Delete</a></li></t>
<t t-if="widget.view.is_action_enabled('edit')">
<li><a type="edit">Edit...</a></li>
</t>
<t t-if="widget.view.is_action_enabled('delete')">
<li><a type="delete">Delete</a></li>
</t>
<li><ul class="oe_kanban_colorpicker" data-field="color"/></li>
</ul>
</div>
<div class = "oe_kanban_content">
<h3 class="oe_kanban_ellipsis"><field name="name"/></h3>
<div class="oe_kanban_alias" t-if="record.alias_id.value">
<span class="oe_e">%%</span><small><field name="alias_id"/></small>
<a title="Mail" t-att-href="'mailto:'+record.alias_id.value">
<span class="oe_e">%%</span><small><field name="alias_id"/></small>
</a>
</div>
<div class="oe_job oe_kanban_ellipsis"><field name="department_id"/></div>
<img t-att-src="kanban_image('hr.employee', 'image_small', widget.values.manager_id.value.id)" t-att-title="record.manager_id.value.name" class="oe_kanban_avatar"/>
<div class="oe_name"><t t-esc="record.manager_id.value.name"/></div>
<t t-if="widget.values.no_of_recruitment.value gt 0">
<div class="oe_application">
<a t-if="widget.values.priority_count.value.total_application gt 1"><t t-esc="Math.round(widget.values.priority_count.value.total_application)"/> Applications</a>
<a t-if="widget.values.priority_count.value.total_application lt 2"><t t-esc="Math.round(widget.values.priority_count.value.total_application)"/> Application</a>
</div>
<div style="margin-top: 6px;color: #4c4c4c;"><t t-esc="Math.round(record.no_of_recruitment.raw_value)"/> Expected New Employees</div>
<field state="recruit" name="no_of_recruitment" widget="gage" style="width:167px; height: 102px;" options="{'min_field': 'no_of_hired_employee','max_field': 'no_of_recruitment', 'label_field': 'no_of_hired_employee', 'action_change': 'action_hired_employee'}">Forecast</field>
<div class="oe_job oe_kanban_ellipsis">
<field name="department_id"/>
</div>
<img t-att-src="kanban_image('hr.employee', 'image', record.manager_id.value.id, {'preview_image': 'image_small'})" t-att-title="record.manager_id.value.name" class="oe_kanban_avatar"/>
<div class="oe_name">
<t t-esc="record.manager_id.value.name"/>
</div>
<t t-if="record.no_of_recruitment.value gt 0">
<div class="oe_application">
<a name="%(hr_job_applications)d" type="action" >
<div t-if="record.priority_count.value.total_application gt 1" ><t t-esc="Math.round(record.priority_count.value.total_application)"/> Applications</div>
<div t-if="record.priority_count.value.total_application lt 2" ><t t-esc="Math.round(record.priority_count.value.total_application)"/> Application</div>
</a>
</div>
<div style="margin-top: 6px;color: #4c4c4c;"><t t-esc="Math.round(record.no_of_recruitment.raw_value)"/> Expected New Employees</div>
<field state="recruit" name="no_of_recruitment" widget="gage" style="width:167px; height: 102px;" options="{'min_field': 'no_of_hired_employee','max_field': 'no_of_recruitment', 'label_field': 'no_of_hired_employee', 'action_change': 'action_hired_employee'}">Forecast</field>
</t>
<div class="oe_kanban_footer_left oe_job_message">
<t t-raw="record.message_summary.raw_value"/>
</div>
<t t-if="record.no_of_recruitment.value lt 1">
<div style="padding-top: 13px;">
<p style="font-size: 14px;color: gray;">To start a recruitment phase for this job position,<b>click here</b></p>
<img src="/hr_recruitment/static/src/img/down1.png" style="margin-top: -24px; width: 25px;height: 25px;float: right;padding-right: 88px;"/>
</div>
</t>
<div class="oe_kanban_footer_left oe_job_message"><t t-raw="record.message_summary.raw_value"/></div>
<t t-if="widget.values.no_of_recruitment.value lt 1">
<div style="padding-top: 13px;"><p style="font-size: 14px;color: gray;">To start a recruitment phase for this job position,<b>click here</b></p><img src="/hr_recruitment/static/src/img/down1.png" style="margin-top: -24px; width: 25px;height: 25px;float: right;padding-right: 88px;"/> </div>
</t>
<div class="oe_job_launch">
<a t-if="widget.values.survey_id.value" data-name="action_print_survey" data-type="object" class=" oe_kanban_action oe_kanban_action_a">Print Interview | </a>
<a t-if="widget.values.no_of_recruitment.value lt 1" data-name="job_recruitment" data-type="object" class=" oe_kanban_action oe_kanban_action_a ">Launch Recruitment</a>
<a t-if="widget.values.no_of_recruitment.value gt 0" data-name="job_open" data-type="object" class=" oe_kanban_action oe_kanban_action_a ">Recruitment Done</a>
<a t-if="record.survey_id.value" data-name="action_print_survey" data-type="object" class=" oe_kanban_action oe_kanban_action_a">Print Interview | </a>
<a t-if="record.no_of_recruitment.value lt 1" data-name="job_recruitment" data-type="object" class=" oe_kanban_action oe_kanban_action_a ">Launch Recruitment</a>
<a t-if="record.no_of_recruitment.value gt 0" data-name="job_open" data-type="object" class=" oe_kanban_action oe_kanban_action_a ">Recruitment Done</a>
</div>
</div>
</div>

View File

@ -33,5 +33,6 @@ class hr_applicant_settings(osv.osv_memory):
fetchmail_model='hr.applicant', fetchmail_name='Incoming HR Applications',
help ="""Allow applicants to send their job application to an email address (jobs@mycompany.com),
and create automatically application documents in the system."""),
'default_alias_prefix': fields.char('Default Alias Prefix for Jobs', default_model='hr.job'),
}

View File

@ -25,6 +25,12 @@
<label for="module_document_ftp"/>
</div>
</div>
<xpath expr="//div/div[@name='hr_recruitment']" position="after">
<div attrs="{'invisible': [('module_hr_recruitment','=',False)]}">
<label for="default_alias_prefix"/>
<field name="default_alias_prefix" class="oe_inline"/>
</div>
</xpath>
</field>
</record>
</data>