!8527 添加功能

Merge pull request !8527 from 李鹏宇/dev_zhou
This commit is contained in:
李鹏宇
2026-02-02 02:16:23 +00:00
committed by Gitee
@@ -167,13 +167,13 @@ class OvertimeApprovals(models.Model):
corrected_end_time = max_allowed_end_time - timedelta(hours=8)
rec.end_time = corrected_end_time
@api.depends('users_id', 'duration')
@api.depends('users_id', 'duration', 'start_time')
def _compute_overtime_hours(self):
for rec in self:
rec.overtime_hours = 0.0
if not rec.users_id:
if not rec.users_id or not rec.start_time:
continue
now = datetime.now() # 获取当前时间(datetime类型)
now = rec.start_time # 获取当前时间(datetime类型)
first_datetime = datetime(now.year, now.month, 1, 0, 0, 0)
if now.month == 12:
next_month_datetime = datetime(now.year + 1, 1, 1, 0, 0, 0)