[IMP]hr_holidays,hr_recruitment:improved HR module related changes and also make one wizard

bzr revid: ron@tinyerp.com-20110216120450-nvul499jx6f3wekd
This commit is contained in:
ron@tinyerp.com 2011-02-16 17:34:50 +05:30
parent 4fc5537bd8
commit f34b5ba2f1
8 changed files with 122 additions and 9 deletions

View File

@ -5,6 +5,7 @@
<!-- Casual leave -->
<record model="hr.holidays.status" id="holiday_status_cl">
<field name="name">Casual Leave</field>
<field name="limit">True</field>
<field name="color_name">black</field>
</record>

View File

@ -93,11 +93,11 @@
<newline/>
<field name="state" colspan="2"/>
<group colspan="2" col="6">
<button string="Refuse" name="refuse" states="confirm,validate,validate1" type="workflow" icon="gtk-no" groups="base.group_hr_user,base.group_hr_manager"/>
<button string="Refuse" name="refuse" states="confirm" type="workflow" icon="gtk-no" groups="base.group_hr_user,base.group_hr_manager"/>
<button string="Submit to Manager" name="confirm" states="draft" type="workflow" icon="gtk-yes"/>
<button string="Approve" name="validate" states="confirm" type="workflow" icon="gtk-apply" groups="base.group_hr_user"/>
<button string="Approved" name="second_validate" states="validate1" type="workflow" icon="gtk-apply" groups="base.group_hr_user"/>
<button string="Set to Draft" name="set_to_draft" states="refuse" type="object" icon="gtk-convert" groups="base.group_hr_user"/>
<button string="Set to Draft" name="set_to_draft" states="refuse,validate,validate1" type="object" icon="gtk-convert" groups="base.group_hr_user"/>
</group>
</page>
</notebook>
@ -135,11 +135,11 @@
<newline/>
<field name="state" colspan="2"/>
<group colspan="2" col="6">
<button string="Refuse" name="refuse" states="confirm,validate,validate1" type="workflow" icon="gtk-no" groups="base.group_hr_user"/>
<button string="Refuse" name="refuse" states="confirm" type="workflow" icon="gtk-no" groups="base.group_hr_user"/>
<button string="Confirm" name="confirm" states="draft" type="workflow" icon="gtk-yes"/>
<button string="Approve" name="validate" states="confirm" type="workflow" icon="gtk-apply" groups="base.group_hr_user"/>
<button string="Approved" name="second_validate" states="validate1" type="workflow" icon="gtk-apply" groups="base.group_hr_user"/>
<button string="Set to Draft" name="set_to_draft" states="cancel" type="object" icon="gtk-convert" groups="base.group_hr_user"/>
<button string="Set to Draft" name="set_to_draft" states="cancel,validate,validate1" type="object" icon="gtk-convert" groups="base.group_hr_user"/>
</group>
</page>
</notebook>

View File

@ -36,6 +36,7 @@ system to store and search in your CV base.
'depends': ['decimal_precision', 'hr', 'survey', 'crm'],
'update_xml': [
'wizard/hr_recruitment_phonecall_view.xml',
'wizard/hr_recruitment_employee_hired.xml',
'wizard/hr_recruitment_create_partner_job_view.xml',
'hr_recruitment_view.xml',
'hr_recruitment_menu.xml',

View File

@ -411,12 +411,29 @@ class hr_applicant(crm.crm_case, osv.osv):
for (id, name) in self.name_get(cr, uid, ids):
message = _("Applicant '%s' is being hired.") % name
self.log(cr, uid, id, message)
applicant = self.browse(cr, uid, ids)[0]
if applicant.job_id:
emp_id = employee_obj.create(cr,uid,{'name': applicant.name,'job_id': applicant.job_id.id})
if not applicant.job_id:
raise osv.except_osv(_('Warning!'),_('You must define job Id for Applicant !'))
emp_id = employee_obj.create(cr,uid,{'name': applicant.name,'job_id': applicant.job_id.id})
return res
def case_close_without_emp(self, cr, uid, ids, *args):
"""
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case's Ids
@param *args: Give Tuple Value
"""
employee_obj = self.pool.get('hr.employee')
job_obj = self.pool.get('hr.job')
res = super(hr_applicant, self).case_close(cr, uid, ids, *args)
for (id, name) in self.name_get(cr, uid, ids):
message = _("Applicant '%s' is being hired.") % name
self.log(cr, uid, id, message)
return res
def case_reset(self, cr, uid, ids, *args):
"""Resets case as draft
@param self: The object pointer

View File

@ -77,7 +77,6 @@
<field name="name" string="Subject"/>
<field name="partner_name"/>
<field name="job_id" on_change="onchange_job(job_id)"/>
<button string="Phone Call" name="%(action_hr_recruitment_phonecall)d" icon="terp-call-start" type="action" groups="base.group_extended"/>
<button name="action_makeMeeting" type="object" string="Meeting" icon="gtk-index"/>
<newline/>
<field name="department_id" widget="selection"/>
@ -133,7 +132,7 @@
<button name="case_cancel" string="Refused" states="draft,open,pending" type="object" icon="gtk-cancel"/>
<button name="case_open" string="In Progress" states="draft,pending" type="object" icon="gtk-go-forward"/>
<button name="case_pending" string="Pending" states="open" type="object" icon="gtk-media-pause"/>
<button name="case_close" string="Hired" states="open,pending" type="object" icon="terp-partner"/>
<button name="%(action_hr_recruitment_hired_employee)d" string="Hired" states="open,pending" type="action" icon="terp-partner"/>
<button name="case_reset" string="Reset to New" states="done,cancel" type="object" icon="gtk-convert"/>
</group>
</page>

View File

@ -22,6 +22,7 @@
import hr_recruitment_phonecall
import hr_recruitment_create_partner_job
import hr_recruitment_employee_hired
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,61 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import osv, fields
from tools.translate import _
class hired_employee(osv.osv_memory):
_name = 'hired.employee'
_description = 'Create Employee'
def case_close(self, cr, uid,ids, context=None):
"""
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case's Ids
@param *args: Give Tuple Value
"""
if context is None:
context = {}
hr_app = self.pool.get('hr.applicant')
hr_app.case_close(cr, uid,context.get('active_ids',False))
return {}
def case_close_without_emp(self, cr, uid,ids, context=None):
"""
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case's Ids
"""
if context is None:
context = {}
hr_app = self.pool.get('hr.applicant')
hr_app.case_close_without_emp(cr, uid,context.get('active_ids',False))
return {}
hired_employee()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_hr_recruitment_hired_employee" model="ir.ui.view">
<field name="name">hr.recruitment.hired2employee.form</field>
<field name="model">hired.employee</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Create New Employee">
<group col="4" colspan="6">
<separator string="Would you like to create an employee ?" colspan="4" />
<newline />
</group>
<group col="3" colspan="4">
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
<button name="case_close_without_emp" string="No" icon='gtk-no' type="object"/>
<button name="case_close" string="Yes" colspan="1" type="object" icon="terp-camera_test"/>
</group>
</form>
</field>
</record>
<record id="action_hr_recruitment_hired_employee" model="ir.actions.act_window">
<field name="name">Create Employee</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">hired.employee</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>