[IMP] hr_equipment,hr_recruitment : Clean 2 methods

This commit is contained in:
Yannick Tivisse
2015-09-23 11:35:02 +02:00
committed by Richard Mathot
parent be2a911c67
commit de0acbfec6
2 changed files with 6 additions and 11 deletions
+4 -7
View File
@@ -249,16 +249,13 @@ class HrEquipmentRequest(models.Model):
@api.multi
def archive_equipment_request(self):
""" Archive an hr.equipment.request as it was refused """
for equipment_request in self:
equipment_request.write({'active': False})
self.write({'active': False})
@api.multi
def reset_equipment_request(self):
""" Reinsert the equipment request into the maintenance pipe"""
for equipment_request in self:
first_stage_obj = self.env['hr.equipment.stage'].search([], order="sequence asc", limit=1)
equipment_request.write({'active': True, 'stage_id': first_stage_obj.id})
""" Reinsert the equipment request into the maintenance pipe in the first stage"""
first_stage_obj = self.env['hr.equipment.stage'].search([], order="sequence asc", limit=1)
self.write({'active': True, 'stage_id': first_stage_obj.id})
@api.onchange('employee_id', 'department_id')
def onchange_department_or_employee_id(self):
@@ -439,13 +439,11 @@ class Applicant(models.Model):
@api.multi
def archive_applicant(self):
""" Archive an hr.applicant as it was refused """
for applicant in self:
applicant.write({'active': False})
self.write({'active': False})
@api.multi
def reset_applicant(self):
""" Reinsert the applicant into the recruitment pipe"""
""" Reinsert the applicant into the recruitment pipe in the first stage"""
for applicant in self:
first_stage_obj = self.env['hr.recruitment.stage'].search([('job_ids', 'in', applicant.job_id.id)], order="sequence asc", limit=1)
applicant.write({'active': True, 'stage_id': first_stage_obj.id})