This commit is contained in:
Bakry 2024-08-21 16:40:32 +03:00
parent ba6c4c1a76
commit d920ccbd89
4 changed files with 25 additions and 14 deletions

View File

@ -150,7 +150,7 @@ class employee_overtime_request(models.Model):
for rec in self:
rec.chick_not_mission()
manager = rec.sudo().employee_id.parent_id
hr_manager = rec.sudo().employee_id.user_id.company_id.hr_manager_id
hr_manager = rec.sudo().employee_id.company_id.hr_manager_id
if manager:
if manager.user_id.id == rec.env.uid or hr_manager.user_id.id == rec.env.uid:
rec.write({'state': 'direct_manager'})
@ -163,7 +163,7 @@ class employee_overtime_request(models.Model):
for rec in self:
rec.chick_not_mission()
manager = rec.sudo().employee_id.coach_id
hr_manager = rec.sudo().employee_id.user_id.company_id.hr_manager_id
hr_manager = rec.sudo().employee_id.company_id.hr_manager_id
if manager:
if manager.user_id.id == rec.env.uid or hr_manager.user_id.id == rec.env.uid:
rec.write({'state': 'financial_manager'})

View File

@ -361,7 +361,7 @@ class HrPersonalPermission(models.Model):
for rec in self:
approve_by = rec.sudo().employee_id.resource_calendar_id.approval_by
manager = rec.sudo().employee_id.parent_id
hr_manager = rec.sudo().employee_id.user_id.company_id.hr_manager_id
hr_manager = rec.sudo().employee_id.company_id.hr_manager_id
if manager:
if (manager.user_id.id == rec.env.uid or hr_manager.user_id.id == rec.env.uid):
if approve_by!='direct_manager':
@ -374,9 +374,7 @@ class HrPersonalPermission(models.Model):
if approve_by!='direct_manager':
rec.write({'state': 'direct_manager'})
else:
rec.approve()
rec.approve()
def approve(self):
self.state = "approve"
@ -389,7 +387,7 @@ class HrPersonalPermission(models.Model):
def direct_manager_refused(self):
for rec in self:
manager = rec.sudo().employee_id.parent_id
hr_manager = rec.sudo().employee_id.user_id.company_id.hr_manager_id
hr_manager = rec.sudo().employee_id.company_id.hr_manager_id
if manager:
if manager.user_id.id == rec.env.uid or hr_manager.user_id.id == rec.env.uid:
rec.refused()

View File

@ -2353,11 +2353,17 @@ msgstr "حفظ الاجازة?"
#. module: hr_holidays_public
#: code:addons/hr_holidays_public/models/hr_holidays.py:0
#: code:addons/hr_holidays_public/models/hr_holidays.py:0
#, python-format
msgid "Select employee Replacement before The approve holiday Request"
msgstr "يجب ادخال الموظف البديل قبل تصديق طلب الاجازة!"
#. module: hr_holidays_public
#: code:addons/hr_holidays_public/models/hr_holidays.py:0
#, python-format
msgid "The replacement Employee Must be entered To Giving him Access"
msgstr "يجب ادخال الموظف البديل حتى يتم منحه الصلاحيات!"
#. module: hr_holidays_public
#: model:ir.model.fields,help:hr_holidays_public.field_public_holidays_next_year_wizard__template_ids
msgid ""

View File

@ -1343,8 +1343,11 @@ class HRHolidays(models.Model):
self.write({'state': 'confirm'})
def hr_manager(self):
if not self.replace_by and self.type == 'remove' and self.holiday_status_id.alternative_chick == True:
raise exceptions.Warning(_('Select employee Replacement before The approve holiday Request'))
if not self.replace_by and self.type == 'remove':
if self.holiday_status_id.alternative_chick == True:
raise exceptions.Warning(_('Select employee Replacement before The approve holiday Request'))
if self.delegate_acc == True:
raise exceptions.Warning(_('The replacement Employee Must be entered To Giving him Access'))
if self.holiday_status_id.attach_chick == True and self.type == 'remove':
if self.attach_ids:
for rec in self.attach_ids:
@ -1356,7 +1359,7 @@ class HRHolidays(models.Model):
#The Approval For The Direct Manager only
for rec in self:
manager = rec.sudo().employee_id.parent_id
hr_manager = rec.sudo().employee_id.user_id.company_id.hr_manager_id
hr_manager = rec.sudo().employee_id.company_id.hr_manager_id
if manager:
if manager.user_id.id == rec.env.uid or hr_manager.user_id.id == rec.env.uid:
rec._chick_leave_balance()
@ -1377,8 +1380,12 @@ class HRHolidays(models.Model):
def financial_manager(self):
for item in self:
if not item.replace_by and item.type == 'remove' and self.holiday_status_id.alternative_chick == True:
raise exceptions.Warning(_('Select employee Replacement before The approve holiday Request'))
if not item.replace_by and item.type == 'remove':
if item.holiday_status_id.alternative_chick == True:
raise exceptions.Warning(_('Select employee Replacement before The approve holiday Request'))
if item.delegate_acc == True:
raise exceptions.Warning(_('The replacement Employee Must be entered To Giving him Access'))
current_date = (datetime.utcnow() + timedelta(hours=3)).date()
employee_balance = self.env['hr.holidays'].search([('employee_id', '=', item.employee_id.id),
('holiday_status_id', '=', item.holiday_status_id.id),
@ -1601,7 +1608,7 @@ class HRHolidays(models.Model):
def direct_manager_refused(self):
for rec in self:
manager = rec.sudo().employee_id.parent_id
hr_manager = rec.sudo().employee_id.user_id.company_id.hr_manager_id
hr_manager = rec.sudo().employee_id.company_id.hr_manager_id
if manager:
if manager.user_id.id == rec.env.uid or hr_manager.user_id.id == rec.env.uid:
rec.refuse()