From 172634850dee007834fad6725b4e14a1cda83ea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= <9664676+pengyuthon@user.noreply.gitee.com> Date: Fri, 30 Jan 2026 18:42:37 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_holiday/models/inherit_hr_leave.py | 2 - .../models/yuthon_hr_employee.py | 37 +++++++------------ 2 files changed, 14 insertions(+), 25 deletions(-) diff --git a/yuthon_holiday/models/inherit_hr_leave.py b/yuthon_holiday/models/inherit_hr_leave.py index d15f6e511..131d0f8ca 100644 --- a/yuthon_holiday/models/inherit_hr_leave.py +++ b/yuthon_holiday/models/inherit_hr_leave.py @@ -841,8 +841,6 @@ class HolidaysRequestBatch(models.Model): def _compute_holiday_allowance(self): current_date = fields.Date.today() current_year = current_date.year - year_start = fields.Date.from_string(f"{current_year}-01-01") - year_end = fields.Date.from_string(f"{current_year}-12-31") for record in self: record.holiday_allowance = "年假0.000天, 补休0.000天, 育儿假0.000天" diff --git a/yuthon_hr_employee/models/yuthon_hr_employee.py b/yuthon_hr_employee/models/yuthon_hr_employee.py index bc7352558..2d128c6c4 100644 --- a/yuthon_hr_employee/models/yuthon_hr_employee.py +++ b/yuthon_hr_employee/models/yuthon_hr_employee.py @@ -940,29 +940,6 @@ class YuthonHrEmployee(models.Model): holiday_status_id = self.env['hr.leave.type'].search([('name', '=', '育儿假')], limit=1) # 更新报表 parenting_line_ids = [] - reports_id = self.env['yuthon.vacation.reports'].search([ - ('employee_id', '=', employee.id), - ('vacation_date', '=', fields.Date.today().replace(day=1)) - ], limit=1) # - if reports_id: - existing_line = reports_id.parenting_line_ids.search([ - ('vacation_id', '=', reports_id.id), - ('employee_id', '=', employee.id), - ('update_date', '=', date_from), - ('end_date', '=', date_to), - ('text','=', '育儿假分配') - ], limit=1) - if not existing_line: - parenting_line_ids.append([0, 0, { - 'vacation_id': reports_id.id, - 'employee_id': employee.id, - 'update_date': date_from, - 'end_date': date_to, - 'lines': total_days, - 'text': '育儿假分配' - }]) - if parenting_line_ids : - reports_id.write({'parenting_line_ids': parenting_line_ids}) # 6. 检查是否已存在相同分配记录,避免重复 existing_allocation = self.env['hr.leave.allocation'].search([ @@ -974,6 +951,20 @@ class YuthonHrEmployee(models.Model): ], limit=1) if existing_allocation: continue + + reports_id = self.env['yuthon.vacation.reports'].search([ + ('employee_id', '=', employee.id), + ('vacation_date', '=', fields.Date.today().replace(day=1)) + ], limit=1) # + if reports_id: + reports_id.parenting_line_ids.search([ + ('vacation_id', '=', reports_id.id), + ('employee_id', '=', employee.id), + ('update_date', '=', date_from), + ('end_date', '=', date_to), + ('text','=', '育儿假分配') + ], limit=1) + self.env['hr.leave.allocation'].create({ 'name': '育儿假分配', 'allocation_type': 'regular', From 916f17fc2be01d4446f03b8bae0b2ad066350ebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= <9664676+pengyuthon@user.noreply.gitee.com> Date: Fri, 30 Jan 2026 19:44:15 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../models/overtime_approval.py | 1 + .../models/yuthon_vacation_reports.py | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/yuthon_hr_attendance/models/overtime_approval.py b/yuthon_hr_attendance/models/overtime_approval.py index c6f4a5c30..94beebc68 100644 --- a/yuthon_hr_attendance/models/overtime_approval.py +++ b/yuthon_hr_attendance/models/overtime_approval.py @@ -66,6 +66,7 @@ class OvertimeApprovals(models.Model): workflow_records = self.env['soong.workflow.record'].search([ ('workflow_id.name', '=', '加班'), ('create_uid', '=', self.env.user.id), + ('reclaim_state', '=', False), ]) if not workflow_records: continue diff --git a/yuthon_hr_attendance/models/yuthon_vacation_reports.py b/yuthon_hr_attendance/models/yuthon_vacation_reports.py index c99b4f090..6f10b75dd 100644 --- a/yuthon_hr_attendance/models/yuthon_vacation_reports.py +++ b/yuthon_hr_attendance/models/yuthon_vacation_reports.py @@ -38,6 +38,7 @@ class YuthonVacationReports(models.Model): year_sum = fields.Float(string="本年调休合计", digits=(16, 3), compute="_compute_year_sum") previous_year1 = fields.Float(string="上年剩余(补休)", digits=(16, 3)) # 固定值 dynamic_previous_year1 = fields.Float(string="上年剩余(补休)", digits=(16, 3)) # 动态值 + dynamic_remainder_year1 = fields.Float(string="本年剩余(补休)", digits=(16, 3)) # 动态值 this_year1 = fields.Float(string="本年剩余(补休)", digits=(16, 3), compute="_compute_year_sum") used_this_year1 = fields.Float(string="本年已休", digits=(16, 3)) remainder_year1 = fields.Float(string="剩余(补休)", digits=(16, 3), compute="_compute_year_sum") @@ -743,6 +744,15 @@ class YuthonVacationReports(models.Model): if rec.working_overtime: overtime_hours = rec.working_overtime * 8 self._update_over_lines(rec, [rec], overtime_hours) + if rec.remaining_parental_leave and last_month_record.parenting_line_ids: + update_date = last_month_record.parenting_line_ids[0].update_date + end_date = last_month_record.parenting_line_ids[0].end_date + if rec.end_date: + date_condition = update_date <= rec.vacation_date <= end_date + else: + date_condition = rec.vacation_date >= update_date + if date_condition: + self._update_parental_leave_lines(rec, [rec], rec.remaining_parental_leave, update_date, end_date) @api.depends('medical_fee_ids.update_type', 'medical_fee_ids.lines', 'medical_fee_ids.is_void') def _compute_medical_fee(self): @@ -1026,6 +1036,24 @@ class YuthonVacationReports(models.Model): 'text': f"上月额度继承" }) + def _update_parental_leave_lines(self, report, allocations, number_of_hours_display, update_date, end_date): + for alloc in allocations: + existing_line = self.env['vacation.parenting.line'].search([ + ('vacation_id', '=', report.id), + ('employee_id', '=', report.employee_id.id), + ('text', '=', '上月额度继承'), + ], limit=1) + if existing_line: + continue + self.env['vacation.parenting.line'].create({ + 'vacation_id': report.id, + 'employee_id': report.employee_id.id, + 'update_date': update_date, + 'end_date': end_date, + 'lines': number_of_hours_display, + 'text': f"上月额度继承", + }) + def log(self): return { "type": "ir.actions.act_window", From 3899b274e4b903a7e6ea2b18e2b88765c03adb93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= <9664676+pengyuthon@user.noreply.gitee.com> Date: Fri, 30 Jan 2026 19:45:56 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_hr_attendance/models/yuthon_vacation_reports.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/yuthon_hr_attendance/models/yuthon_vacation_reports.py b/yuthon_hr_attendance/models/yuthon_vacation_reports.py index 6f10b75dd..1d5b6d364 100644 --- a/yuthon_hr_attendance/models/yuthon_vacation_reports.py +++ b/yuthon_hr_attendance/models/yuthon_vacation_reports.py @@ -38,7 +38,6 @@ class YuthonVacationReports(models.Model): year_sum = fields.Float(string="本年调休合计", digits=(16, 3), compute="_compute_year_sum") previous_year1 = fields.Float(string="上年剩余(补休)", digits=(16, 3)) # 固定值 dynamic_previous_year1 = fields.Float(string="上年剩余(补休)", digits=(16, 3)) # 动态值 - dynamic_remainder_year1 = fields.Float(string="本年剩余(补休)", digits=(16, 3)) # 动态值 this_year1 = fields.Float(string="本年剩余(补休)", digits=(16, 3), compute="_compute_year_sum") used_this_year1 = fields.Float(string="本年已休", digits=(16, 3)) remainder_year1 = fields.Float(string="剩余(补休)", digits=(16, 3), compute="_compute_year_sum") @@ -273,7 +272,7 @@ class YuthonVacationReports(models.Model): record.year_sum = record.last_holiday + record.last_workday + record.year_holiday + record.year_workday record.remainder_year1 = record.last_holiday + record.last_workday + record.year_holiday + record.year_workday - record.used_this_year1 record.previous_year1 = record.last_holiday + record.last_workday - record.this_year1 = record.year_holiday + record.year_workday + record.this_year1 = record.year_holiday + record.year_workday - record.used_this_year1 @api.constrains('employee_id', 'vacation_date') def _check_duplicate_monthly_record(self):