[IMP]Improved write method and previous_stage_id to last_stage_id.
bzr revid: bth@tinyerp.com-20130819093136-52igwbmi3bx30b6i
This commit is contained in:
parent
accf719374
commit
ef21f58651
|
@ -214,7 +214,7 @@ class hr_applicant(osv.Model):
|
|||
'emp_id': fields.many2one('hr.employee', string='Employee',
|
||||
help='Employee linked to the applicant.'),
|
||||
'user_email': fields.related('user_id', 'email', type='char', string='User Email', readonly=True),
|
||||
'previous_stage_id': fields.many2one ('hr.recruitment.stage', 'Previous Stage'),
|
||||
'last_stage_id': fields.many2one ('hr.recruitment.stage', 'Last Stage'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
|
@ -393,17 +393,20 @@ class hr_applicant(osv.Model):
|
|||
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()
|
||||
for data in self.browse(cr, uid, ids, context=context):
|
||||
vals['previous_stage_id'] = data.stage_id.id
|
||||
|
||||
# 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)
|
||||
if 'stage_id' not in vals:
|
||||
return super(hr_applicant, self).write(cr, uid, ids, vals, context=context)
|
||||
|
||||
for data in self.browse(cr, uid, ids, context=context):
|
||||
# stage change: update date_last_stage_update
|
||||
vals['date_last_stage_update'] = fields.datetime.now()
|
||||
vals['last_stage_id'] = data.stage_id.id
|
||||
super(hr_applicant, self).write(cr, uid, ids, vals, context=context)
|
||||
return True
|
||||
|
||||
def create_employee_from_applicant(self, cr, uid, ids, context=None):
|
||||
""" Create an hr.employee from the hr.applicants """
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
<field name="arch" type="xml">
|
||||
<tree string="Applicants" fonts="bold:message_unread==True">
|
||||
<field name="message_unread" invisible="1"/>
|
||||
<field name="previous_stage_id" invisible="1"/>
|
||||
<field name="last_stage_id" invisible="1"/>
|
||||
<field name="create_date"/>
|
||||
<field name="date_last_stage_update" invisible="1"/>
|
||||
<field name="name" string="Subject"/>
|
||||
|
@ -195,7 +195,7 @@
|
|||
<filter string="Degree" domain="[]" context="{'group_by':'type_id'}"/>
|
||||
<filter string="Availability" domain="[]" context="{'group_by':'availability'}"/>
|
||||
<filter string="Appreciation" domain="[]" context="{'group_by':'priority'}"/>
|
||||
<filter string="Previous Stage" help="Match this group by with a specific stage filter in order to analyse the recruitment process" context="{'group_by':'previous_stage_id'}"/>
|
||||
<filter string="Last Stage" help="Match this group by with a specific stage filter in order to analyse the recruitment process" context="{'group_by':'last_stage_id'}"/>
|
||||
<filter string="Stage" domain="[]" context="{'group_by':'stage_id'}"/>
|
||||
<filter string="Source" domain="[]" context="{'group_by':'source_id'}"/>
|
||||
<filter string="Creation Date" domain="[]" context="{'group_by':'create_date'}"/>
|
||||
|
|
|
@ -61,7 +61,7 @@ class hr_recruitment_report(osv.Model):
|
|||
'available': fields.float("Availability"),
|
||||
'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"),
|
||||
'previous_stage_id': fields.many2one ('hr.recruitment.stage', 'Previous Stage'),
|
||||
'last_stage_id': fields.many2one ('hr.recruitment.stage', 'Last Stage'),
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
|
@ -85,7 +85,7 @@ class hr_recruitment_report(osv.Model):
|
|||
s.department_id,
|
||||
s.priority,
|
||||
s.stage_id,
|
||||
s.previous_stage_id,
|
||||
s.last_stage_id,
|
||||
sum(salary_proposed) as salary_prop,
|
||||
(sum(salary_proposed)/count(*)) as salary_prop_avg,
|
||||
sum(salary_expected) as salary_exp,
|
||||
|
@ -107,7 +107,7 @@ class hr_recruitment_report(osv.Model):
|
|||
s.company_id,
|
||||
s.user_id,
|
||||
s.stage_id,
|
||||
s.previous_stage_id,
|
||||
s.last_stage_id,
|
||||
s.type_id,
|
||||
s.priority,
|
||||
s.job_id,
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<field name="user_id" invisible="1"/>
|
||||
<field name="job_id"/>
|
||||
<field name="stage_id" invisible="1" />
|
||||
<field name="previous_stage_id" invisible="1"/>
|
||||
<field name="last_stage_id" invisible="1"/>
|
||||
<field name="department_id" invisible="1"/>
|
||||
<field name="type_id" invisible="1"/>
|
||||
<field name="partner_id" invisible="1"/>
|
||||
|
@ -69,7 +69,7 @@
|
|||
<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="Previous Stage" help="Match this group by with a specific stage filter in order to analyse the recruitment process" context="{'group_by':'previous_stage_id'}"/>
|
||||
<filter string="Last Stage" help="Match this group by with a specific stage filter in order to analyse the recruitment process" context="{'group_by':'last_stage_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"/>
|
||||
|
|
Loading…
Reference in New Issue