添加功能

This commit is contained in:
李鹏宇
2026-02-02 10:16:03 +08:00
parent 12b42d79df
commit a3c2f04f68
@@ -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)