Merge pull request #2758 from expsa/Esraa-Ensan-hr-tasks
appraisal check
This commit is contained in:
commit
abe3a5d837
|
|
@ -223,22 +223,23 @@ class Appraisal(models.Model):
|
|||
self.state = 'draft'
|
||||
|
||||
def set_state_done(self):
|
||||
for item in self:
|
||||
if item.appraisal_type != 'training' and item.employee_id.user_id == self.env.user:
|
||||
raise exceptions.Warning(
|
||||
_('The evaluation is approved by the direct manager "%s" If you have any problems, contact your manager.') % item.employee_id.parent_id.user_id.name)
|
||||
|
||||
if item.employee_protest and item.state == 'draft':
|
||||
item.state = 'employee_confirmation'
|
||||
else:
|
||||
# Update appraisal result in contract
|
||||
if item.employee_id.contract_id:
|
||||
if item.appraisal_result:
|
||||
item.employee_id.contract_id.appraisal_result_id = item.appraisal_result
|
||||
if self.appraisal_type != 'training' and self.employee_id.user_id == self.env.user:
|
||||
raise exceptions.Warning(
|
||||
_('The evaluation is approved by the direct manager "%s" If you have any problems, contact your manager.'))
|
||||
else:
|
||||
for item in self:
|
||||
if item.employee_protest and item.state == 'draft':
|
||||
item.state = 'employee_confirmation'
|
||||
else:
|
||||
raise exceptions.Warning(
|
||||
_('There is no contract for employee "%s" to update appraisal result ') % item.employee_id.name)
|
||||
item.state = 'state_done'
|
||||
# Update appraisal result in contract
|
||||
if item.employee_id.contract_id:
|
||||
if item.appraisal_result:
|
||||
item.employee_id.contract_id.appraisal_result_id = item.appraisal_result
|
||||
else:
|
||||
raise exceptions.Warning(
|
||||
_('There is no contract for employee "%s" to update appraisal result ') % item.employee_id.name)
|
||||
item.state = 'state_done'
|
||||
|
||||
|
||||
def closed(self):
|
||||
self.state = 'closed'
|
||||
|
|
|
|||
Loading…
Reference in New Issue