This commit is contained in:
李鹏宇
2026-02-02 10:26:25 +08:00
2 changed files with 11 additions and 4 deletions
@@ -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)
@@ -965,7 +965,14 @@ class YuthonHrEmployee(models.Model):
('text','=', '育儿假分配')
], limit=1)
if not parenting_line_ids:
reports_id.sudo().write({'parenting_line_ids': parenting_line_ids})
reports_id.parenting_line_ids.sudo().create({
'vacation_id': reports_id.id,
'employee_id': employee.id,
'update_date': date_from,
'lines': total_days,
'end_date': date_to,
'text': '育儿假分配'
})
self.env['hr.leave.allocation'].create({
'name': '育儿假分配',