diff --git a/soong_workflow/wizard/soong_workflow_comment_wizard.py b/soong_workflow/wizard/soong_workflow_comment_wizard.py index e08cbd2b8..84a82b859 100644 --- a/soong_workflow/wizard/soong_workflow_comment_wizard.py +++ b/soong_workflow/wizard/soong_workflow_comment_wizard.py @@ -411,12 +411,6 @@ class SoongWorkflowCommentWizard(models.TransientModel): is_admin = self.env.user.has_group('soong_workflow.group_soong_workflow_manager') log_done_by_ids = [log.done_by.id for log in record_id.log_ids if log.done_by] if self.node_btn_name == '转交': - if self.res_model == 'hr.leave.batch': - if not record_id.holiday_allowance2: - record_id._compute_holiday_allowance() - record_id.write({ - 'holiday_allowance2': record_id.holiday_allowance, - }) has_comment_note = bool(self.comment_note_id) has_comment = bool(self.comment and self.comment.strip()) if not has_comment_note and not has_comment: diff --git a/yuthon_holiday/models/inherit_hr_leave.py b/yuthon_holiday/models/inherit_hr_leave.py index c26549f38..3e807fa8c 100644 --- a/yuthon_holiday/models/inherit_hr_leave.py +++ b/yuthon_holiday/models/inherit_hr_leave.py @@ -963,6 +963,7 @@ class HolidaysRequestBatch(models.Model): elif hour_leave_line.holiday_status_id.name == '补休': total_compensatory_leave_days += leave_days + record.holiday_allowance2 = record.holiday_allowance if total_annual_leave_days > self.remaining_annual_leave: raise UserError('年假天数额度不足,无法请假') if total_compensatory_leave_days > self.remaining_compensatory_leave: diff --git a/yuthon_hr_attendance/models/overtime_approval.py b/yuthon_hr_attendance/models/overtime_approval.py index a338268f3..6da57e0ba 100644 --- a/yuthon_hr_attendance/models/overtime_approval.py +++ b/yuthon_hr_attendance/models/overtime_approval.py @@ -34,6 +34,7 @@ class OvertimeApprovals(models.Model): overtime_methods = fields.Selection([('leave', '补休'), ('fee', '加班费结算')], string='加班补偿方式', default='leave') duration = fields.Float(string="结算时长", compute='_compute_duration', store=True) overtime_hours = fields.Float(string="本月加班时长", compute='_compute_overtime_hours') + overtime_hours1 = fields.Float(string="本月加班时长") # 固定值 start_time = fields.Datetime(string="开始时间") allocation_id = fields.Many2one('hr.leave.allocation', string="补休记录") attendance_id = fields.Many2one('hr.attendance', string="当天考勤") @@ -186,7 +187,9 @@ class OvertimeApprovals(models.Model): ('workflow_id.name', '=', '加班'), ('create_uid', '=', rec.users_id.id), ('approve_state', 'in', ['pending', 'end']), + ('reclaim_state', '!=', True), ]) + overtime_name_list = [] total_overtime = 0.0 for workflow in workflow_records: related_model = self.env[workflow.res_model].browse(workflow.res_id) @@ -194,12 +197,13 @@ class OvertimeApprovals(models.Model): if first_datetime <= start_time <= last_datetime: if related_model.duration: total_overtime += related_model.duration - + overtime_name_list.append(related_model.name) 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: + self.overtime_hours1 = self.overtime_hours + if self.overtime_hours1 + self.duration > 36 and not self.is_thwg: message = _('本月已加班时长已超过 36 小时') raise ValidationError(message) diff --git a/yuthon_hr_attendance/views/overtime_approval.xml b/yuthon_hr_attendance/views/overtime_approval.xml index 2c4e1511c..9577f8e39 100644 --- a/yuthon_hr_attendance/views/overtime_approval.xml +++ b/yuthon_hr_attendance/views/overtime_approval.xml @@ -113,7 +113,8 @@ - + +