Merge pull request #2152 from expsa/bakry_hr3

edit attendance more one in day
This commit is contained in:
bakry 2025-01-20 11:22:27 +03:00 committed by GitHub
commit d4dbd6cbbd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 4 deletions

View File

@ -68,10 +68,10 @@ class HrAttendanceRegister(models.Model):
raise exceptions.Warning(_('You can not Register Attendance After Today'))
# item.date = currnt_date
priv_register = self.env['hr.attendance.register'].search([('employee_id', '=', item.employee_id.id),('id','!=',item.id)])
for reg in priv_register:
date = datetime.strptime(str(reg.action_date), '%Y-%m-%d %H:%M:%S').strftime('%Y-%m-%d')
if date == currnt_date:
raise exceptions.Warning(_('You can not Register Attendance More Than once in The Same day'))
#for reg in priv_register:
# date = datetime.strptime(str(reg.action_date), '%Y-%m-%d %H:%M:%S').strftime('%Y-%m-%d')
# if date == currnt_date:
# raise exceptions.Warning(_('You can not Register Attendance More Than once in The Same day'))
if currnt_date > str(item.register_date):
raise exceptions.Warning(_('You can not Register Attendance At Future Date'))