[IMP] hr_recruitment: added date_last_stage_update field, holding date of last stage modification; removed hired.employee wizard that does not seem to be used anywhere, nor to be useful.
bzr revid: tde@openerp.com-20130708091156-3l6fcl6drd4b6w2y
This commit is contained in:
parent
ef9923feb4
commit
05359f0909
|
@ -47,7 +47,7 @@ You can define the different phases of interviews and easily rate the applicant
|
|||
'fetchmail',
|
||||
],
|
||||
'data': [
|
||||
'wizard/hr_recruitment_employee_hired.xml',
|
||||
# 'wizard/hr_recruitment_employee_hired.xml',
|
||||
'wizard/hr_recruitment_create_partner_job_view.xml',
|
||||
'hr_recruitment_view.xml',
|
||||
'hr_recruitment_menu.xml',
|
||||
|
|
|
@ -185,10 +185,9 @@ class hr_applicant(osv.Model):
|
|||
'categ_ids': fields.many2many('hr.applicant_category', string='Tags'),
|
||||
'company_id': fields.many2one('res.company', 'Company'),
|
||||
'user_id': fields.many2one('res.users', 'Responsible', track_visibility='onchange'),
|
||||
# Applicant Columns
|
||||
'date_closed': fields.datetime('Closed', readonly=True, select=True),
|
||||
'date_open': fields.datetime('Opened', readonly=True, select=True),
|
||||
'date': fields.datetime('Date'),
|
||||
'date_open': fields.datetime('Assigned', readonly=True, select=True),
|
||||
'date_last_stage_update': fields.datetime('Last Stage Update', select=True),
|
||||
'date_action': fields.date('Next Action Date'),
|
||||
'title_action': fields.char('Next Action', size=64),
|
||||
'priority': fields.selection(AVAILABLE_PRIORITIES, 'Appreciation'),
|
||||
|
@ -224,6 +223,7 @@ class hr_applicant(osv.Model):
|
|||
'department_id': lambda s, cr, uid, c: s._get_default_department_id(cr, uid, c),
|
||||
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'hr.applicant', context=c),
|
||||
'color': 0,
|
||||
'date_last_stage_update': fields.datetime.now(),
|
||||
}
|
||||
|
||||
_group_by_full = {
|
||||
|
@ -390,7 +390,20 @@ class hr_applicant(osv.Model):
|
|||
self.pool.get('hr.job').message_post(cr, uid, [applicant.job_id.id], body=_('Applicant <b>created</b>'), subtype="hr_recruitment.mt_job_new_applicant", context=context)
|
||||
return obj_id
|
||||
|
||||
def case_close_with_emp(self, cr, uid, ids, context=None):
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
if isinstance(ids, (int, long)):
|
||||
ids = [ids]
|
||||
# stage change: update date_last_stage_update
|
||||
if 'stage_id' in vals:
|
||||
vals['date_last_stage_update'] = fields.datetime.now()
|
||||
# user_id change: update date_start
|
||||
if vals.get('user_id'):
|
||||
vals['date_start'] = fields.datetime.now()
|
||||
|
||||
return super(hr_applicant, self).write(cr, uid, ids, vals, context=context)
|
||||
|
||||
def create_employee_from_applicant(self, cr, uid, ids, context=None):
|
||||
""" Create an hr.employee from the hr.applicants """
|
||||
if context is None:
|
||||
context = {}
|
||||
hr_employee = self.pool.get('hr.employee')
|
||||
|
|
|
@ -86,9 +86,12 @@
|
|||
<label for="name" class="oe_edit_only"/>
|
||||
<h1><field name="name"/></h1>
|
||||
<label for="partner_name" class="oe_edit_only"/>
|
||||
<h2>
|
||||
<h2 style="display: inline-block;">
|
||||
<field name="partner_name" class="oe_inline"/>
|
||||
</h2>
|
||||
<button string="Create Employee" name="create_employee_from_applicant" type="object"
|
||||
class="oe_link oe_inline" style="margin-left: 8px;"
|
||||
attrs="{'invisible': [('emp_id', '!=', False)]}"/>
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
|
@ -134,13 +137,7 @@
|
|||
<span class="oe_inline" attrs="{'invisible':[('salary_proposed_extra','=',False)]}"> + </span>
|
||||
<field name="salary_proposed_extra" class="oe_inline" placeholder="Extra advantages..."/>
|
||||
</div>
|
||||
<label for="emp_id"/>
|
||||
<div>
|
||||
<field name="emp_id" readonly="1"/>
|
||||
<button string="Create Employee" name="case_close_with_emp" type="object"
|
||||
class="oe_link oe_inline"
|
||||
attrs="{'invisible': [('emp_id', '!=', False)]}"/>
|
||||
</div>
|
||||
<field name="emp_id" readonly="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
|
@ -173,7 +170,7 @@
|
|||
<field name="name">Jobs - Recruitment Search</field>
|
||||
<field name="model">hr.applicant</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Jobs">
|
||||
<search string="Search Applicants">
|
||||
<field name="partner_name" filter_domain="['|','|',('name','ilike',self),('partner_name','ilike',self),('email_from','ilike',self)]" string="Subject / Applicant"/>
|
||||
<filter string="Unassigned" domain="[('user_id', '=', False)]"/>
|
||||
<filter string="My" domain="[('user_id', '=', uid)]"/>
|
||||
|
|
|
@ -25,11 +25,12 @@ from .. import hr_recruitment
|
|||
from openerp.addons.decimal_precision import decimal_precision as dp
|
||||
|
||||
|
||||
class hr_recruitment_report(osv.osv):
|
||||
class hr_recruitment_report(osv.Model):
|
||||
_name = "hr.recruitment.report"
|
||||
_description = "Recruitments Statistics"
|
||||
_auto = False
|
||||
_rec_name = 'date'
|
||||
_rec_name = 'date_create'
|
||||
_order = 'date_create desc'
|
||||
|
||||
_columns = {
|
||||
'user_id': fields.many2one('res.users', 'User', readonly=True),
|
||||
|
@ -44,7 +45,8 @@ class hr_recruitment_report(osv.osv):
|
|||
'company_id': fields.many2one('res.company', 'Company', readonly=True),
|
||||
'day': fields.char('Day', size=128, readonly=True),
|
||||
'year': fields.char('Year', size=4, readonly=True),
|
||||
'date': fields.date('Date', readonly=True),
|
||||
'date_create': fields.date('Create Date', readonly=True),
|
||||
'date_last_stage_update': fields.datetime('Last Stage Update', readonly=True),
|
||||
'date_closed': fields.date('Closed', readonly=True),
|
||||
'job_id': fields.many2one('hr.job', 'Applied Job',readonly=True),
|
||||
'stage_id': fields.many2one ('hr.recruitment.stage', 'Stage'),
|
||||
|
@ -60,15 +62,16 @@ class hr_recruitment_report(osv.osv):
|
|||
'delay_close': fields.float('Avg. Delay to Close', digits=(16,2), readonly=True, group_operator="avg",
|
||||
help="Number of Days to close the project issue"),
|
||||
}
|
||||
_order = 'date desc'
|
||||
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'hr_recruitment_report')
|
||||
cr.execute("""
|
||||
create or replace view hr_recruitment_report as (
|
||||
select
|
||||
min(s.id) as id,
|
||||
date_trunc('day',s.create_date) as date,
|
||||
date_trunc('day',s.create_date) as date_create,
|
||||
date_trunc('day',s.date_closed) as date_closed,
|
||||
date_trunc('day',s.date_last_stage_update) as date_last_stage_update,
|
||||
to_char(s.create_date, 'YYYY') as year,
|
||||
to_char(s.create_date, 'MM') as month,
|
||||
to_char(s.create_date, 'YYYY-MM-DD') as day,
|
||||
|
@ -85,7 +88,7 @@ class hr_recruitment_report(osv.osv):
|
|||
(sum(salary_proposed)/count(*)) as salary_prop_avg,
|
||||
sum(salary_expected) as salary_exp,
|
||||
(sum(salary_expected)/count(*)) as salary_exp_avg,
|
||||
extract('epoch' from (s.date_closed-s.create_date))/(3600*24) as delay_close,
|
||||
extract('epoch' from (s.date_closed-s.create_date))/(3600*24) as delay_close,
|
||||
count(*) as nbr
|
||||
from hr_applicant s
|
||||
group by
|
||||
|
@ -97,6 +100,7 @@ class hr_recruitment_report(osv.osv):
|
|||
s.date_open,
|
||||
s.create_date,
|
||||
s.date_closed,
|
||||
s.date_last_stage_update,
|
||||
s.partner_id,
|
||||
s.company_id,
|
||||
s.user_id,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<field name="model">hr.recruitment.report</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Recruitment Analysis" create="false">
|
||||
<field name="date" invisible="1"/>
|
||||
<field name="date_create" invisible="1"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
<field name="job_id"/>
|
||||
<field name="stage_id" invisible="1" />
|
||||
|
@ -17,6 +17,7 @@
|
|||
<field name="year" invisible="1"/>
|
||||
<field name="day" invisible="1"/>
|
||||
<field name="month" invisible="1"/>
|
||||
<field name="date_last_stage_update" invisible="1"/>
|
||||
<field name="nbr" sum="# of Applications"/>
|
||||
<field name="available" sum="Available"/>
|
||||
<field name="salary_exp" sum="Expected Salary"/>
|
||||
|
@ -57,20 +58,21 @@
|
|||
<field name="priority"/>
|
||||
<field name="stage_id"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
<field name="date" string="Creation Date"/>
|
||||
<field name="date_create"/>
|
||||
<field name="date_closed"/>
|
||||
</group>
|
||||
<group expand="1" string="Group By ...">
|
||||
<filter string="Responsible" name='User' icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
|
||||
<filter string="Company" icon="terp-go-home" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
|
||||
<filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}" />
|
||||
<filter string="Jobs" name="job" icon="terp-gtk-select-all" domain="[]" context="{'group_by':'job_id'}"/>
|
||||
<filter string="Department" name="department" icon="terp-personal+" domain="[]" context="{'group_by':'department_id'}"/>
|
||||
<filter string="Degree" name="degree" icon="terp-gtk-select-all" domain="[]" context="{'group_by':'type_id'}"/>
|
||||
<filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}" />
|
||||
<filter string="Day" name = "day" icon="terp-go-today" domain="[]" context="{'group_by':'day'}" help="Creation Date"/>
|
||||
<filter string="Month" icon="terp-go-month" domain="[]" context="{'group_by':'month'}" help="Creation Date"/>
|
||||
<filter string="Year" icon="terp-go-year" domain="[]" context="{'group_by':'year'}" help="Creation Date"/>
|
||||
<filter string="Responsible" name='User' context="{'group_by':'user_id'}"/>
|
||||
<filter string="Company" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
|
||||
<filter string="Partner" context="{'group_by':'partner_id'}" />
|
||||
<filter string="Jobs" name="job" context="{'group_by':'job_id'}"/>
|
||||
<filter string="Department" name="department" context="{'group_by':'department_id'}"/>
|
||||
<filter string="Degree" name="degree" context="{'group_by':'type_id'}"/>
|
||||
<filter string="Stage" context="{'group_by':'stage_id'}" />
|
||||
<filter string="Last Stage Update" context="{'group_by':'date_last_stage_update'}" />
|
||||
<filter string="Day" name="day" context="{'group_by':'day'}" help="Creation Date"/>
|
||||
<filter string="Month" context="{'group_by':'month'}" help="Creation Date"/>
|
||||
<filter string="Year" context="{'group_by':'year'}" help="Creation Date"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
|
|
|
@ -43,20 +43,8 @@
|
|||
I print Applicant fill up the interview quetion
|
||||
-
|
||||
!python {model: hr.applicant}: |
|
||||
self.action_print_survey(cr, uid, [ref('hr_case_programmer')])
|
||||
-
|
||||
I do not give employment to the hired the applicant.
|
||||
-
|
||||
!python {model: hired.employee}: |
|
||||
context.update({'active_model': 'hr.applicant', 'active_ids': [ref("hr_recruitment.hr_case_programmer")], 'active_id': ref("hr_recruitment.hr_case_programmer")})
|
||||
emp_id = self.create(cr, uid, {}, context=context)
|
||||
-
|
||||
Now I give employment to hired applicant .
|
||||
-
|
||||
!python {model: hr.applicant}: |
|
||||
hired_emp_obj = self.pool.get('hired.employee')
|
||||
context.update({'active_model': 'hr.applicant', 'active_ids': [ref("hr_recruitment.hr_case_programmer")], 'active_id': ref("hr_recruitment.hr_case_programmer")})
|
||||
emp_hr_id = hired_emp_obj.create(cr, uid, {}, context=context)
|
||||
self.action_print_survey(cr, uid, [ref('hr_case_programmer')])
|
||||
-
|
||||
Now hired employee want to be a partner of company.
|
||||
-
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
# Copyright (C) 2004-Today OpenERP (<http://www.openerp.com>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
|
@ -19,9 +19,7 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
import hr_recruitment_create_partner_job
|
||||
import hr_recruitment_employee_hired
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
# -*- 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 openerp.osv import fields, osv
|
||||
from openerp.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 user’s ID for security checks,
|
||||
@param ids: List of case's Ids
|
||||
@param *args: Give Tuple Value
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
self.pool.get('hr.applicant').case_close(cr, uid,context.get('active_ids',[]))
|
||||
return {}
|
||||
|
||||
def case_close_with_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 user’s ID for security checks,
|
||||
@param ids: List of case's Ids
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
return self.pool.get('hr.applicant').case_close_with_emp(cr, uid,context.get('active_ids', []))
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -1,30 +0,0 @@
|
|||
<?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="arch" type="xml">
|
||||
<form string="Create New Employee" version="7.0">
|
||||
<header>
|
||||
<button name="case_close_with_emp" string="Yes" type="object" class="oe_highlight" />
|
||||
<button name="case_close" string="No" type="object"/>
|
||||
or
|
||||
<button string="Cancel" class="oe_link" special="cancel" />
|
||||
</header>
|
||||
<label string="Would you like to create an employee ?"/>
|
||||
</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>
|
Loading…
Reference in New Issue