!9646 添加功能

Merge pull request !9646 from 李鹏宇/dev_zhou
This commit is contained in:
李鹏宇
2026-03-12 09:45:47 +00:00
committed by Gitee
4 changed files with 9 additions and 9 deletions
@@ -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:
@@ -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:
@@ -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)
@@ -113,7 +113,8 @@
<group col="2">
<group>
<field name="is_thwg" invisible="1"/>
<field name="overtime_hours" readonly="1"/>
<field name="overtime_hours" readonly="1" invisible="overtime_hours1"/>
<field name="overtime_hours1" invisible="not overtime_hours1" readonly="1"/>
<field name="meal" required="1" invisible="is_thwg or is_lc"/>
</group>
<group/>