@@ -117,17 +117,17 @@ class OvertimeApprovals(models.Model):
|
||||
continue
|
||||
|
||||
# 一个月加班时长不能超过36小时
|
||||
first_day = rec.start_time.replace(day=1, hour=0, minute=0, second=0, microsecond=0)
|
||||
first_day = rec.start_time.date().replace(day=1)
|
||||
vacation_report = self.env['yuthon.vacation.reports'].search([
|
||||
('employee_id', '=', employee.id),
|
||||
('vacation_date', '==', first_day),
|
||||
('vacation_date', '=', first_day),
|
||||
], limit=1)
|
||||
|
||||
cop_leave = vacation_report.cop_leave if vacation_report else 0.0
|
||||
cop_leave = vacation_report.done_working_overtime * 8 if vacation_report else 0.0
|
||||
leave_hours = calculated_hours
|
||||
if cop_leave + leave_hours > 36:
|
||||
rec.duration = 0.0
|
||||
message = f'本月已请假 {cop_leave} 小时,超过 36 小时上限!'
|
||||
message = f'本月已加班时长已超过 36 小时'
|
||||
raise ValidationError(message)
|
||||
else:
|
||||
rec.duration = calculated_hours
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
<label for="end_time"/>
|
||||
<div class="d-inline-flex w-100">
|
||||
<field name="end_time" string="结束日期:" class="me-2"
|
||||
style="max-width: 17rem !important;"/>
|
||||
style="max-width: 17rem !important;" required="1"/>
|
||||
<field name="end_week" string=" " class="ms-2"
|
||||
style="max-width: 5rem !important;"/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user