考勤确认单接口
This commit is contained in:
@@ -115,17 +115,5 @@ class CustomerPortal(portal.CustomerPortal):
|
||||
@http.route('/phone/vacation/self/status', type='http', auth="none", csrf=False, cors='*')
|
||||
def phone_vacation_self_status(self, **kw):
|
||||
record_id = request.env['yuthon.vacation.reports'].sudo().search([('id', '=', kw.get('id'))])
|
||||
month_start = record_id.vacation_date.replace(day=1)
|
||||
month_end = (month_start + relativedelta(months=1) - relativedelta(days=1))
|
||||
attendance_exception = self.env['hr.attendance'].search([
|
||||
('employee_id', '=', record_id.employee_id.id),
|
||||
('current_data', '>=', month_start),
|
||||
('current_data', '<=', month_end),
|
||||
('is_abnormal', '=', True)
|
||||
], limit=1)
|
||||
# 如果考勤异常,则不自动确认
|
||||
if attendance_exception:
|
||||
return json.dumps({'code': 200, 'message': '考勤异常,请先核对考勤记录'})
|
||||
else:
|
||||
record_id.write({'vacation_state': 'confirmed'})
|
||||
return json.dumps({'code': 200, 'message': 'OK'})
|
||||
record_id.write({'vacation_state': 'confirmed'})
|
||||
return json.dumps({'code': 200, 'message': 'OK'})
|
||||
|
||||
Reference in New Issue
Block a user