@@ -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': ''})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user