From 54de7495784fc0f0f32cf3ae7ace7614b9882a04 Mon Sep 17 00:00:00 2001 From: odex Date: Thu, 11 Jul 2024 18:17:29 +0300 Subject: [PATCH] fix some bug --- .../odex_mobile/controllers/rest_api_v2/leave.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/odex25_mobile/odex_mobile/controllers/rest_api_v2/leave.py b/odex25_mobile/odex_mobile/controllers/rest_api_v2/leave.py index c5a12f3e9..1fbdee646 100644 --- a/odex25_mobile/odex_mobile/controllers/rest_api_v2/leave.py +++ b/odex25_mobile/odex_mobile/controllers/rest_api_v2/leave.py @@ -225,12 +225,14 @@ class LeaveController(http.Controller): holidays = http.request.env['hr.holidays'].sudo().create(vals) if 'attachment' in body and body['attachment']: attach = http.request.env['ir.attachment'].sudo().create({ - 'name': body['attachment'].filename, - 'datas': base64.b64encode(body['attachment'].read()), - 'store_fname': body['attachment'].filename, - 'res_model': 'hr.holidays', - 'res_id': holidays.id, - }) + 'name': body['attachment'].filename, + 'datas': base64.b64encode(body['attachment'].read()), + 'store_fname': body['attachment'].filename, + 'res_model': 'hr.holidays', + 'res_id': holidays.id, + 'att_holiday_ids': holidays.id, + }) + holidays.attach_ids = [(4,attach.id)] if holidays: # holidays.confirm() holidays.number_of_days_temp = holidays._get_number_of_days(body['start_date'], body['end_date'], @@ -306,7 +308,6 @@ class LeaveController(http.Controller): 'res_id': holidays.id, 'att_holiday_ids': holidays.id, }) - print(attach) holidays.attach_ids = [(4,attach.id)] data = self.get_return_data(holidays, approvel) return http_helper.response(message=_("Leave Updated Successfully"), data={'leaves': [data]})