From 6afe7d896e420dc637ddb69fda4bc5e307398954 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: Wed, 15 Oct 2025 16:41:06 +0800 Subject: [PATCH] =?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_breastfeed_leave.py | 15 ++ .../models/yuthon_fixes_approval.py | 2 +- yuthon_hr_attendance/models/hr_attendance.py | 45 ++++- .../views/hr_attendance_views.xml | 4 +- .../wizard/attendance_correct_wizard.py | 189 ++++++++++-------- .../wizard/attendance_correct_wizard.xml | 1 + .../models/property_bank_statements.py | 2 + .../models/property_meter_archives.py | 4 +- .../models/property_meter_water.py | 17 +- .../views/property_bank_statements_views.xml | 3 +- .../views/property_meter_archives_views.xml | 4 +- .../views/property_meter_water_views.xml | 10 +- .../views/yuthon_property_views.xml | 2 +- .../wizard/electric_water_wizard.py | 24 ++- .../wizard/property_meter_wizard.py | 32 ++- .../wizard/property_water_wizard.py | 54 ++--- .../models/inherit_yuthon_property.py | 6 +- .../models/property_lease_contract.py | 5 +- .../views/property_lease_contract.xml | 6 +- 19 files changed, 266 insertions(+), 159 deletions(-) diff --git a/yuthon_holiday/models/yuthon_breastfeed_leave.py b/yuthon_holiday/models/yuthon_breastfeed_leave.py index 851e7beb7..cd3730db4 100644 --- a/yuthon_holiday/models/yuthon_breastfeed_leave.py +++ b/yuthon_holiday/models/yuthon_breastfeed_leave.py @@ -27,3 +27,18 @@ class YuthonBreastfeedLeave(models.Model): name_title = fields.Char(default=_get_default_name_title) self_users_ids = fields.Many2many('res.users', string="当前经办人", default=lambda self: [(6, 0, [self.env.user.id])]) + + def end_approval(self): + self.ensure_one() + employee = self.users_id.employee_id + breastfeeding_type = '1' if self.time_slot_selection == 'morning' else '2' + self.env['breastfeeding.holiday'].create({ + 'resource_calendar_id': employee.resource_calendar_id.id, + 'employee_id': employee.id, + 'breastfeeding_type': breastfeeding_type, + 'calendar_start_time': self.start_date, + 'calendar_end_time': self.end_date, + 'check_in': 9, + 'check_out': 16, + }) + self.write({'work_end': True}) diff --git a/yuthon_holiday/models/yuthon_fixes_approval.py b/yuthon_holiday/models/yuthon_fixes_approval.py index cc60f5a60..c52b70b6a 100644 --- a/yuthon_holiday/models/yuthon_fixes_approval.py +++ b/yuthon_holiday/models/yuthon_fixes_approval.py @@ -43,7 +43,7 @@ class YuthonFixesApproval(models.Model): @api.onchange('holiday_status') def _onchange_holiday_status(self): - if self.holiday_status: + if self.holiday_status and self.vacation_id: if self.holiday_status == 'annual': self.original_hours = self.vacation_id.leave else: diff --git a/yuthon_hr_attendance/models/hr_attendance.py b/yuthon_hr_attendance/models/hr_attendance.py index b82a031a4..593a8fc6f 100644 --- a/yuthon_hr_attendance/models/hr_attendance.py +++ b/yuthon_hr_attendance/models/hr_attendance.py @@ -489,20 +489,49 @@ class HrAttendance(models.Model): "view_mode": "form", "target": "new", "context": { - "default_attendance_id": self.id + "default_attendance_ids": [(6, 0, [self.id])] } } - - def button_compensatory_leave(self): - form_id = self.env.ref('yuthon_hr_attendance.view_yuthon_adjustments_approval_form').id + def all_button_correct_wizard(self): + self.approval_check_in = self.check_in + self.approval_check_out = self.check_out + self.is_approval_no = self.is_no_card + self.is_approval_early = self.is_early_card + self.is_approval_late = self.is_late_card + self.is_approval_abnormal = self.is_abnormal + self.is_approval_abs = self.absenteeism_card return { "type": "ir.actions.act_window", - "name": "调休申请", - "res_model": "yuthon.adjustments.approval", - "views": [[form_id, "form"]], + "name": "修正弹窗", + "res_model": "attendance.correct.wizard", + "view_mode": "form", + "target": "new", "context": { - 'default_users_id': self.employee_id.user_id.id, + "default_attendance_ids": [(6, 0, [self.id])] + } + } + + def button_compensatory_leave(self): + attendance_ids = self.env["hr.attendance"].browse( + self._context.get('active_ids', self._context.get('active_id')) + ) + for record in attendance_ids: + record.approval_check_in = record.check_in + record.approval_check_out = record.check_out + record.is_approval_no = record.is_no_card + record.is_approval_early = record.is_early_card + record.is_approval_late = record.is_late_card + record.is_approval_abnormal = record.is_abnormal + record.is_approval_abs = record.absenteeism_card + return { + "type": "ir.actions.act_window", + "name": "修正弹窗", + "res_model": "attendance.correct.wizard", + "view_mode": "form", + "target": "new", + "context": { + "default_attendance_ids": [(6, 0, attendance_ids.ids)] } } diff --git a/yuthon_hr_attendance/views/hr_attendance_views.xml b/yuthon_hr_attendance/views/hr_attendance_views.xml index 882b90e5b..280124b8b 100644 --- a/yuthon_hr_attendance/views/hr_attendance_views.xml +++ b/yuthon_hr_attendance/views/hr_attendance_views.xml @@ -18,7 +18,9 @@ btn-primary"/>-->