diff --git a/soong_workflow/models/soong_workflow_record.py b/soong_workflow/models/soong_workflow_record.py
index b3602fab5..d6fd06597 100644
--- a/soong_workflow/models/soong_workflow_record.py
+++ b/soong_workflow/models/soong_workflow_record.py
@@ -63,6 +63,21 @@ class SoongWorkflowRecord(models.Model):
res.append_date2(res)
return res
+ def restore(self):
+ workflow_ids = self.env["soong.workflow.record"].browse(
+ self._context.get('active_ids', self._context.get('active_id', [])))
+ for workflow in workflow_ids:
+ record_id = self.env[workflow.res_model].search([('id', '=', workflow.res_id)])
+ if record_id.log_ids:
+ record_id.log_ids[-1].approval_state = '0'
+ if hasattr(record_id, 'work_end'):
+ record_id.work_end = False
+ if hasattr(record_id, 'self_users_ids'):
+ record_id.self_users_ids = [(6, 0, [record_id.log_ids[-1].done_by.id])]
+ workflow.employee_ids = [(6, 0, [record_id.log_ids[-1].done_by.employee_id.id])]
+ workflow.soong_state = 'to_do'
+ workflow.approve_state = 'pending'
+
def append_date2(self, res):
res.workflow_happen_date = False
if res.approvals_group_id.name == '考勤':
@@ -157,6 +172,8 @@ class SoongWorkflowRecord(models.Model):
})
workflow.approve_state = 'end'
+ workflow.soong_state = 'done'
+ workflow.employee_ids = [(6, 0, [])]
def execute_button_code(self, button_id, res_model, res_id):
diff --git a/soong_workflow/views/soong_workflow_record.xml b/soong_workflow/views/soong_workflow_record.xml
index dedae8a43..2f0bcd11b 100644
--- a/soong_workflow/views/soong_workflow_record.xml
+++ b/soong_workflow/views/soong_workflow_record.xml
@@ -255,6 +255,14 @@
action = model.admin_end()
+
+ 恢复
+
+
+ code
+ action = model.restore()
+
+
发生日期
diff --git a/soong_workflow/wizard/soong_bounced_wizard.py b/soong_workflow/wizard/soong_bounced_wizard.py
index 89a8e68dc..c19ec16a7 100644
--- a/soong_workflow/wizard/soong_bounced_wizard.py
+++ b/soong_workflow/wizard/soong_bounced_wizard.py
@@ -23,5 +23,6 @@ class SoongBouncedWizard(models.Model):
log_ids[-1].unlink()
log_ids[-2].write({'approval_state': '1'})
record.write({'state': log_ids[-2].name,
- 'work_end': False
+ 'work_end': False,
+ 'soong_state': 'to_do'
})
\ No newline at end of file
diff --git a/yuthon_hr_attendance/models/overtime_approval.py b/yuthon_hr_attendance/models/overtime_approval.py
index 9bb2ac782..dfd4eae9d 100644
--- a/yuthon_hr_attendance/models/overtime_approval.py
+++ b/yuthon_hr_attendance/models/overtime_approval.py
@@ -29,8 +29,8 @@ class OvertimeApprovals(models.Model):
related_issues_id = fields.Many2one('issue.library', string="关联议题")
documents_ids = fields.Many2many('ir.attachment', string="附件")
overtime_methods = fields.Selection([('leave', '补休'), ('fee', '加班费结算')], string='加班补偿方式', default='leave')
- duration = fields.Float(string="时长", compute='_compute_duration', store=True, help="如果时长大于8则按8小时算")
- overtime_hours = fields.Float(string="本月加班时长")
+ duration = fields.Float(string="结算时长", compute='_compute_duration', store=True)
+ overtime_hours = fields.Float(string="本月加班时长", compute='_compute_duration')
start_time = fields.Datetime(string="开始时间")
attendance_id = fields.Many2one('hr.attendance', string="当天考勤")
start_week = fields.Char(string="星期", compute='_compute_weekday')
@@ -44,7 +44,8 @@ class OvertimeApprovals(models.Model):
default='normal')
active = fields.Boolean('Active', default=True, tracking=True)
work_end = fields.Boolean(string="结束")
- test_field = fields.Char(string="测试字段")
+ is_over = fields.Boolean(string="超过", compute="_compute_duration")
+ over_remake = fields.Text(string="备注", compute="_compute_duration")
def _get_default_name_title(self):
return self._description if self._description else self._name
@@ -88,6 +89,7 @@ class OvertimeApprovals(models.Model):
@api.depends('start_time', 'end_time', 'attendance_id', 'rest_start_time', 'rest_end_time')
def _compute_duration(self):
for rec in self:
+ rec.over_remake = None
rec.duration = 0.0
if not (rec.start_time and rec.end_time):
continue
@@ -111,6 +113,17 @@ class OvertimeApprovals(models.Model):
else:
max_hours = 8.0
rec.duration = min(calculated_hours, max_hours)
+ rec.is_over = calculated_hours > max_hours
+ base_note = f"加班时长为{original_hours}小时\n"
+ if rec.type_overtime == 'work':
+ if rec.is_over:
+ rec.over_remake = f"{base_note}工作日加班不得超过3小时"
+ else:
+ if rec.is_over:
+ rec.over_remake = f"{base_note}节假日加班不得超过{max_hours}小时"
+
+ if rec.rest_end_time and rec.rest_end_time:
+ rec.duration -= (rec.rest_end_time - rec.c).total_seconds() / 3600
employee = rec.users_id.employee_id
if not employee:
@@ -127,14 +140,12 @@ class OvertimeApprovals(models.Model):
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
+ rec.overtime_hours = 0.0
message = f'本月已加班时长已超过 36 小时'
raise ValidationError(message)
else:
- rec.duration = calculated_hours
+ rec.overtime_hours = cop_leave
- if rec.rest_end_time and rec.rest_end_time:
- rec.duration -= (rec.rest_end_time - rec.c).total_seconds()/3600
@api.depends('start_time', 'end_time')
def _compute_weekday(self):
@@ -192,7 +203,6 @@ class OvertimeApprovals(models.Model):
for record in self:
employee_id = self.env['hr.employee'].search([('id', '=', record.users_id.employee_ids.id)])
meal_number = employee_id.meal_number
- record.overtime_hours = employee_id.holiday_overtime_hours + employee_id.weekend_overtime_hours + employee_id.normal_overtime_hours
if self.meal == 'yes':
meal_number += 1
employee_id.write({'meal_number': meal_number})
diff --git a/yuthon_hr_attendance/models/yuthon_vacation_reports.py b/yuthon_hr_attendance/models/yuthon_vacation_reports.py
index 1808759b9..bea4dd5bb 100644
--- a/yuthon_hr_attendance/models/yuthon_vacation_reports.py
+++ b/yuthon_hr_attendance/models/yuthon_vacation_reports.py
@@ -68,6 +68,7 @@ class YuthonVacationReports(models.Model):
att_mount = fields.Integer(string="出勤天数", compute='compute_attendance_fields', store=True, group_operator=None)
attendance_message_log_ids = fields.One2many('attendance.message.log', 'vacation_id')
+ admin_confirms = fields.Boolean(string="是否管理员确认")
vacation_state = fields.Selection(
diff --git a/yuthon_hr_attendance/views/overtime_approval.xml b/yuthon_hr_attendance/views/overtime_approval.xml
index da815bdbd..f8bb2dac7 100644
--- a/yuthon_hr_attendance/views/overtime_approval.xml
+++ b/yuthon_hr_attendance/views/overtime_approval.xml
@@ -84,12 +84,19 @@
+
+
+
+
+
+
+
+
-