@@ -4,6 +4,7 @@ from odoo import fields, http, SUPERUSER_ID, _
|
||||
from odoo.exceptions import AccessError, MissingError, ValidationError
|
||||
from odoo.http import request
|
||||
from ....addons.portal.controllers import portal
|
||||
from datetime import datetime, date, time, timedelta
|
||||
|
||||
|
||||
class CustomerPortal(portal.CustomerPortal):
|
||||
@@ -69,9 +70,21 @@ class CustomerPortal(portal.CustomerPortal):
|
||||
|
||||
@http.route('/phone/vacation/self/detail', type='http', auth="none", csrf=False, cors='*')
|
||||
def phone_vacation_self_detail(self, **kw):
|
||||
records = request.env['yuthon.vacation.reports'].sudo().search([('id', '=', kw.get('id'))])
|
||||
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 = {
|
||||
'日期': records.display_date,
|
||||
'日期': record.display_date,
|
||||
'应到': records.should_attendance,
|
||||
'实到': records.actual_attendance,
|
||||
'迟到': records.is_late_card,
|
||||
|
||||
Reference in New Issue
Block a user