fix Approval For The Direct Manager Only

This commit is contained in:
Bakry 2024-07-18 15:04:07 +03:00
parent ea48f53a54
commit e1fa684406
6 changed files with 55 additions and 4 deletions

View File

@ -3800,3 +3800,15 @@ msgstr "طلب تثبيت راتب"
#: model_terms:ir.ui.view,arch_db:employee_requests.employee_other_request_form_view
msgid "Print Salary Confirmation"
msgstr "طباعة تثبيت الراتب"
#. module: employee_requests
#: code:addons/employee_requests/models/employee_overtime_request.py:0
#, python-format
msgid "Sorry, The Approval For The Direct Manager %s Only OR HR Manager!"
msgstr "للأسف، لموافقة المدير المباشر %s فقط او مدير الموارد البشرية !"
#. module: employee_requests
#: code:addons/employee_requests/models/employee_overtime_request.py:0
#, python-format
msgid "Sorry, The Approval For The Department Manager %s Only OR HR Manager!"
msgstr "للأسف، لموافقة مدير الإدارة %s فقط او مدير الموارد البشرية !"

View File

@ -146,11 +146,27 @@ class employee_overtime_request(models.Model):
def direct_manager(self):
self.chick_not_mission()
self.state = "direct_manager"
#self.state = "direct_manager"
for rec in self:
if rec.employee_id.parent_id:
if rec.employee_id.parent_id.user_id.id == rec.env.uid or rec.env.company.hr_manager_id.user_id == rec.env.uid:
rec.write({'state': 'direct_manager'})
else:
raise exceptions.Warning(_('Sorry, The Approval For The Direct Manager %s Only OR HR Manager!')%(rec.employee_id.parent_id.name))
else:
rec.write({'state': 'direct_manager'})
def financial_manager(self):
self.chick_not_mission()
self.state = "financial_manager"
#self.state = "financial_manager"
for rec in self:
if rec.employee_id.coach_id:
if rec.employee_id.coach_id.user_id.id == rec.env.uid or rec.env.company.hr_manager_id.user_id == rec.env.uid:
rec.write({'state': 'financial_manager'})
else:
raise exceptions.Warning(_('Sorry, The Approval For The Department Manager %s Only OR HR Manager!')%(rec.employee_id.coach_id.name))
else:
rec.write({'state': 'financial_manager'})
def hr_aaproval(self):
self.chick_not_mission()

View File

@ -272,7 +272,15 @@ class HrPersonalPermission(models.Model):
self.state = "send"
def direct_manager(self):
self.state = "direct_manager"
#self.state = "direct_manager"
for rec in self:
if rec.employee_id.parent_id:
if rec.employee_id.parent_id.user_id == rec.env.uid or rec.env.company.hr_manager_id.user_id == rec.env.uid:
rec.write({'state': 'direct_manager'})
else:
raise exceptions.Warning(_('Sorry, The Approval For The Direct Manager %s Only OR HR Manager!')%(rec.employee_id.parent_id.name))
else:
rec.write({'state': 'direct_manager'})
def approve(self):
self.state = "approve"

View File

@ -196,7 +196,7 @@ msgstr "وضع تخصيص"
#: model:ir.model.fields.selection,name:hr_holidays_community.selection__hr_holidays__type__add
#: model:ir.ui.menu,name:hr_holidays_community.menu_open_allocation_holidays
msgid "Allocation Request"
msgstr "طلب التوزيع"
msgstr "طلب اضافة رصيد"
#. module: hr_holidays_community
#: model_terms:ir.ui.view,arch_db:hr_holidays_community.hr_department_view_kanban

View File

@ -3583,3 +3583,9 @@ msgstr ""
msgid "وفـاة"
msgstr ""
#. module: hr_holidays_public
#: code:addons/hr_holidays_public/models/hr_holidays.py:0
#, python-format
msgid "Sorry, The Approval For The Direct Manager %s Only OR HR Manager!"
msgstr "للأسف، لموافقة المدير المباشر %s فقط او مدير الموارد البشرية !"

View File

@ -981,6 +981,15 @@ class HRHolidays(models.Model):
else:
raise exceptions.Warning(
_('Sorry This %s requires a Documents To Be Attached To Approve') % (self.holiday_status_id.name))
#The Approval For The Direct Manager only
for rec in self:
if rec.employee_id.parent_id:
if rec.employee_id.parent_id.user_id.id == rec.env.uid or rec.env.company.hr_manager_id.user_id == rec.env.uid:
rec.write({'state': 'direct_manager'})
else:
raise exceptions.Warning(_('Sorry, The Approval For The Direct Manager %s Only OR HR Manager!')%(rec.employee_id.parent_id.name))
else:
rec.write({'state': 'direct_manager'})
self._chick_leave_balance()
self.write({'state': 'validate'})