appraisal check

This commit is contained in:
Esraa-Exp 2025-04-14 12:37:48 +02:00
parent c30acdcaa7
commit 060cd223d1
1 changed files with 16 additions and 15 deletions

View File

@ -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'