From a635f47e231bfa805b0c79d2cb838e18745a916c Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Thu, 17 Jul 2025 15:40:03 +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 | 8 +- .../models/inherit_hr_leave_allocation.py | 43 +++++-- yuthon_holiday/views/hr_leave_batch.xml | 8 +- .../models/property_split_approval.py | 111 +++++++++++++++--- .../views/property_split_approval_views.xml | 17 +-- yuthon_salary/models/inherit_hr_payslip.py | 5 +- 6 files changed, 159 insertions(+), 33 deletions(-) diff --git a/yuthon_holiday/models/inherit_hr_leave.py b/yuthon_holiday/models/inherit_hr_leave.py index d6c06caed..25b77f17a 100644 --- a/yuthon_holiday/models/inherit_hr_leave.py +++ b/yuthon_holiday/models/inherit_hr_leave.py @@ -148,6 +148,12 @@ class HrLeave(models.Model): ('22', '22:00'), ('22.5', '22:30'), ('23', '23:00'), ('23.5', '23:30')], string='结束时间') + def update_state(self): + leave_ids = self.env["hr.leave"].browse( + self._context.get('active_ids', self._context.get('active_id'))) + for leave in leave_ids: + leave.state = 'draft' + @api.model def create(self, vals): allocation = super(HrLeave, self).create(vals) @@ -201,7 +207,7 @@ class HrLeave(models.Model): self.env['vacation.over.line'].create({ 'vacation_id': reports_id.id, 'employee_id': employee.id, - 'update_type': 'add', + 'update_type': 'reduce', 'workday': allocation.number_of_days * 8, 'legal_day': 0, 'public_holidays': 0, diff --git a/yuthon_holiday/models/inherit_hr_leave_allocation.py b/yuthon_holiday/models/inherit_hr_leave_allocation.py index b73e31872..8c7e107ac 100644 --- a/yuthon_holiday/models/inherit_hr_leave_allocation.py +++ b/yuthon_holiday/models/inherit_hr_leave_allocation.py @@ -106,11 +106,11 @@ class HrLeaveAllocation(models.Model): @api.model def create(self, vals): allocation = super(HrLeaveAllocation, self).create(vals) + employee = allocation.employee_id + hours = allocation.number_of_hours_display if allocation.holiday_status_id.name == '年假' and allocation.state == 'validate': - employee = allocation.employee_id - days = allocation.number_of_hours_display employee.write({ - 'quota_issued': employee.quota_issued + days + 'quota_issued': employee.quota_issued + hours }) reports_id = self.env['yuthon.vacation.reports'].search([ ('employee_id', '=', employee.id) @@ -120,10 +120,24 @@ class HrLeaveAllocation(models.Model): 'vacation_id': reports_id.id, 'update_type': 'add', 'update_date': fields.Datetime.now(), - 'update_lines': days, + 'update_lines': hours, 'allocation_type': 'allocation', 'text': allocation.name }) + elif allocation.holiday_status_id.name == '补休': + reports_id = self.env['yuthon.vacation.reports'].search([ + ('employee_id', '=', employee.id) + ], limit=1) + self.env['vacation.over.line'].create({ + 'vacation_id': reports_id.id, + 'update_type': 'add', + 'update_date': fields.Datetime.now(), + 'workday': hours, + 'legal_day': 0, + 'public_holidays': 0, + 'meal_number': 0, + 'text': allocation.name + }) return allocation def unlink(self): @@ -132,20 +146,33 @@ class HrLeaveAllocation(models.Model): # 检查是否有需要同步的员工记录 if record.employee_id and record.holiday_status_id.name == '年假': employee = record.employee_id - days = record.number_of_hours_display + hours = record.number_of_hours_display lines_to_delete = self.env['vacation.leave.line'].search([ ('vacation_id.employee_id', '=', employee.id), ('update_type', '=', 'add'), - ('update_lines', '=', days), + ('update_lines', '=', hours), ('allocation_type', '=', 'allocation'), ('text', '=', record.name) ]) if lines_to_delete: lines_to_delete.is_void = True employee.write({ - 'quota_issued': employee.quota_issued - days + 'quota_issued': employee.quota_issued - hours }) - return super(HrLeaveAllocation, self).unlink() + elif record.employee_id and record.holiday_status_id.name == '补休': + employee = record.employee_id + hours = record.number_of_hours_display + lines_to_delete = self.env['vacation.over.line'].search([ + ('vacation_id.employee_id', '=', employee.id), + ('update_type', '=', 'add'), + ('workday', '=', hours), + ('text', '=', record.name) + ]) + if lines_to_delete: + lines_to_delete.is_void = True + + return super(HrLeaveAllocation, self).unlink() + def update_vacation(self): leave_ids = self.env["hr.leave.allocation"].browse( diff --git a/yuthon_holiday/views/hr_leave_batch.xml b/yuthon_holiday/views/hr_leave_batch.xml index 051b08425..47321f615 100644 --- a/yuthon_holiday/views/hr_leave_batch.xml +++ b/yuthon_holiday/views/hr_leave_batch.xml @@ -215,7 +215,13 @@ [('employee_id.user_id', '=', uid)] - + + 初始化状态 + + + code + action = model.update_state() +
- - - +
+
- + - - - diff --git a/yuthon_salary/models/inherit_hr_payslip.py b/yuthon_salary/models/inherit_hr_payslip.py index 061bcaafa..61613c440 100644 --- a/yuthon_salary/models/inherit_hr_payslip.py +++ b/yuthon_salary/models/inherit_hr_payslip.py @@ -448,7 +448,7 @@ class InheritHrPayslip(models.Model): } @api.depends('year_compute', 'year_jie', 'year_gong', 'jing_te', 'study_on', 'seniority_allowance', - 'position_salary', 'liquidation_year', + 'position_salary', 'liquidation_year', 'rank_salary', 'quality_allowance', 'high_subsidy', 'environmental_allowance', 'last_duty', 'seniority_salary', 'commuting_allowance', 'base_salary', 'performance_bonuses', 'comprehensive_subsidy', 'full_attendance_award', 'overtime_pay', 'based_pay', @@ -461,6 +461,7 @@ class InheritHrPayslip(models.Model): def _compute_total_before_tax(self): for record in self: record.total_before_tax = ( + record.rank_salary + record.condolence_fund + record.spring_festival + record.liquidation_year + @@ -518,7 +519,7 @@ class InheritHrPayslip(models.Model): record.b_year - record.union_dues - record.tax_payable - - record.maternity_allowance + + record.maternity_allowance - record.individual_income_tax + record.children_welfare_fee + record.add_income_tax + From f1a84be5ba3ae1c563ff364a877e617d28315bdf Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Thu, 17 Jul 2025 15:42:59 +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 --- .../views/property_split_approval_views.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yuthon_property_approval/views/property_split_approval_views.xml b/yuthon_property_approval/views/property_split_approval_views.xml index 76de5e47f..38ac65ac3 100644 --- a/yuthon_property_approval/views/property_split_approval_views.xml +++ b/yuthon_property_approval/views/property_split_approval_views.xml @@ -19,9 +19,9 @@ -
-
+ + + Date: Thu, 17 Jul 2025 16:44:36 +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 --- .../models/yuthon_vacation_reports.py | 16 +++ .../views/yuthon_vacation_reports_views.xml | 100 +++++++++++++++++- 2 files changed, 111 insertions(+), 5 deletions(-) diff --git a/yuthon_holiday/models/yuthon_vacation_reports.py b/yuthon_holiday/models/yuthon_vacation_reports.py index 1460b55fc..14f4ca568 100644 --- a/yuthon_holiday/models/yuthon_vacation_reports.py +++ b/yuthon_holiday/models/yuthon_vacation_reports.py @@ -18,6 +18,22 @@ class YuthonVacationReports(models.Model): working_overtime = fields.Float(string='加班时', compute='_compute_working_overtime', store=True) meal_fee = fields.Integer(string="误餐次数", compute='_compute_meal_fee', store=True) + def overtime_allocation(self): + form_id = self.env.ref('hr_holidays.hr_leave_allocation_view_form_manager').id + holiday_status_id = self.env['hr.leave.type'].search([('name', '=', '补休')]) + return { + 'name': '补休时分配', + 'view_mode': 'form', + 'res_model': 'hr.leave.allocation', + 'type': 'ir.actions.act_window', + 'views': [(form_id, 'form')], + 'context': { + 'default_holiday_status_id': holiday_status_id.id, + 'default_employee_ids': [(6, 0, [self.employee_id.id])], + 'default_allocation_type': 'regular', + 'default_name': '补休增加', + }} + def update_vac(self): vacation_ids = self.env["yuthon.vacation.reports"].browse( self._context.get('active_ids', self._context.get('active_id'))) diff --git a/yuthon_holiday/views/yuthon_vacation_reports_views.xml b/yuthon_holiday/views/yuthon_vacation_reports_views.xml index c635d1bd9..33f6c0fcb 100644 --- a/yuthon_holiday/views/yuthon_vacation_reports_views.xml +++ b/yuthon_holiday/views/yuthon_vacation_reports_views.xml @@ -4,7 +4,7 @@ yuthon.vacation.reports.tree yuthon.vacation.reports - + @@ -19,9 +19,20 @@ yuthon.vacation.reports.form yuthon.vacation.reports - + - + + + + + + + + + + + + @@ -40,6 +51,7 @@ +