Merge pull request #2121 from expsa/bakry_hr3

fix
This commit is contained in:
bakry 2025-01-13 14:25:43 +03:00 committed by GitHub
commit 31fb9630c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View File

@ -446,7 +446,10 @@ class Attendance(models.Model):
def _compute_is_today(self):
today = datetime.now().date()
for record in self:
record.is_today = record.action_date == today
if record.action_date == today:
record.is_today = True
else:
record.is_today = False
@api.depends('name')
def compute_date(self):

View File

@ -636,6 +636,13 @@ class HrAttendanceTransactions(models.Model):
('name', '=', 'to_attendance_device_custom')]) \
and True or False
attendance_pool = self.env['attendance.attendance']
##remove today from not to day in attendance
today = datetime.now().date()
not_today = attendance_pool.search([('is_today', '=', True),('action_date', '<', today)])
if not_today:
for att in not_today:
att._compute_is_today()
##end
low_date = (datetime.utcnow()).date() if not attendance_date else attendance_date
if isinstance(low_date, datetime):
low_date = low_date.date()