This commit is contained in:
Bakry 2024-12-24 15:03:08 +03:00
parent ffb7379680
commit bcea2c19b2
2 changed files with 16 additions and 1 deletions

View File

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

View File

@ -93,7 +93,16 @@ class penalty_register(models.Model):
self.state = 'draft' self.state = 'draft'
def officer(self): def officer(self):
self.state = 'officer' for rec in self:
manager = rec.sudo().employee_id.parent_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': 'officer'})
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': 'officer'})
def manager(self): def manager(self):
self.state = 'manager' self.state = 'manager'