@@ -192,13 +192,14 @@ class OvertimeApprovals(models.Model):
|
||||
if related_model.duration:
|
||||
total_overtime += related_model.duration
|
||||
|
||||
if total_overtime + rec.duration > 36 and not rec.is_thwg:
|
||||
rec.overtime_hours = 0.0
|
||||
message = _('本月已加班时长已超过 36 小时')
|
||||
raise ValidationError(message)
|
||||
else:
|
||||
rec.overtime_hours = total_overtime
|
||||
|
||||
@api.constrains('users_id')
|
||||
def _check_overtime_hours(self):
|
||||
if self.overtime_hours + self.duration > 36 and not self.is_thwg:
|
||||
message = _('本月已加班时长已超过 36 小时')
|
||||
raise ValidationError(message)
|
||||
|
||||
@api.depends('start_time', 'end_time', 'attendance_id', 'rest_start_time', 'rest_end_time')
|
||||
def _compute_duration(self):
|
||||
for rec in self:
|
||||
|
||||
Reference in New Issue
Block a user