From 752e0b888cb47c2b131e06353de59ef84559bc41 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: Mon, 2 Feb 2026 11:28:11 +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 --- yuthon_hr_attendance/controllers/portal.py | 62 +++++++++------------- 1 file changed, 25 insertions(+), 37 deletions(-) diff --git a/yuthon_hr_attendance/controllers/portal.py b/yuthon_hr_attendance/controllers/portal.py index d6c1736f7..5420d287f 100644 --- a/yuthon_hr_attendance/controllers/portal.py +++ b/yuthon_hr_attendance/controllers/portal.py @@ -74,46 +74,34 @@ class CustomerPortal(portal.CustomerPortal): @http.route('/phone/vacation/self/detail', type='http', auth="none", csrf=False, cors='*') def phone_vacation_self_detail(self, **kw): record = request.env['yuthon.vacation.reports'].sudo().search([('id', '=', kw.get('id'))]) - current_date = record.vacation_date - if current_date.month == 1: - last_month_year = current_date.year - 1 - last_month = 12 - else: - last_month_year = current_date.year - last_month = current_date.month - 1 - records = request.env['yuthon.vacation.reports'].sudo().search([ - ('employee_id', '=', record.employee_id.id), - ('vacation_date', '>=', f'{last_month_year}-{last_month:02d}-01'), - ('vacation_date', '<', f'{last_month_year}-{last_month + 1:02d}-01' if last_month < 12 else f'{last_month_year + 1}-01-01') - ], limit=1) data = { 'state': '已确认' if record.vacation_state == 'confirmed' else '待确认', '日期': record.display_date, - '应到': records.should_attendance, - '实到': records.actual_attendance, - '迟到': records.is_late_card, - '早退': records.is_early_card, - '缺卡': records.is_no_card, - '旷工': records.is_work, - '异常': records.is_abnormal, - '年假': records.done_leave, - '加班时': records.done_working_overtime, - '调休': records.compensatory_leave, - '事假': records.leave_of_absence, - '加班时(法定假)': records.statutory_leave, - '育儿假': records.parental_leave, - '值班调休': records.duty_off_leave, - '婚假': records.marriage_leave, - '产假': records.maternity_leave, - '陪产假': records.paternity_leave, - '计生假': records.family_planning_leave, - '丧假': records.bereavement_leave, - '探亲假': records.home_visit_leave, - '家长会假': records.parents_meeting_leave, - '病假(普通)': records.general_sick_leave, - '病假(住院期)': records.hospital_sick_leave, - '病假(出院恢复期)': records.recovery_sick_leave, - '考试假': records.exam_leave, + '应到': record.should_attendance, + '实到': record.actual_attendance, + '迟到': record.is_late_card, + '早退': record.is_early_card, + '缺卡': record.is_no_card, + '旷工': record.is_work, + '异常': record.is_abnormal, + '年假': record.done_leave, + '加班时': record.done_working_overtime, + '调休': record.compensatory_leave, + '事假': record.leave_of_absence, + '加班时(法定假)': record.statutory_leave, + '育儿假': record.parental_leave, + '值班调休': record.duty_off_leave, + '婚假': record.marriage_leave, + '产假': record.maternity_leave, + '陪产假': record.paternity_leave, + '计生假': record.family_planning_leave, + '丧假': record.bereavement_leave, + '探亲假': record.home_visit_leave, + '家长会假': record.parents_meeting_leave, + '病假(普通)': record.general_sick_leave, + '病假(住院期)': record.hospital_sick_leave, + '病假(出院恢复期)': record.recovery_sick_leave, + '考试假': record.exam_leave, } return json.dumps({'data': data, 'code': 200, 'message': ''})