Commit 26fc2d5d by François

Modifications pour avoir souplesse paramétrage absence

parent f8e05261
Pipeline #1325 passed with stage
in 1 minute 23 seconds
......@@ -1142,6 +1142,12 @@ class CagetteServices(models.Model):
# let authorized people time to set presence for those who came in late
end_date = now - datetime.timedelta(hours=3)
api = OdooAPI()
absence_status = 'excused'
res_c = api.search_read('ir.config_parameter',
[['key', '=', 'lacagette_membership.absence_status']],
['value'])
if len(res_c) == 1:
absence_status = res_c[0]['value']
cond = [['date_begin', '>=', date_24h_before.isoformat()],
['date_begin', '<=', end_date.isoformat()],
['state', '=', 'open']]
......@@ -1165,7 +1171,7 @@ class CagetteServices(models.Model):
(_h, _m, _s) = h.split(':')
if int(_h) < 21:
ids.append(int(r['id']))
f = {'state': 'excused'}
f = {'state': absence_status}
return {'update': api.update('shift.registration', ids, f), 'reg_shift': res}
@staticmethod
......
......@@ -239,11 +239,9 @@ def request_delay(request):
}
if ('extension_beginning' in request.POST):
data['extension_beginning'] = request.POST['extension_beginning']
duration = 28
if ('duration' in request.POST):
duration = int(request.POST['duration'])
else:
duration = None
response = {'result': False}
......@@ -252,8 +250,10 @@ def request_delay(request):
if (new_id):
response = {'result': True}
else:
coop_logger.error("request delay : %s, %s", str(new_id), str(data))
return HttpResponseServerError()
except Exception as e:
coop_logger.error("request delay : %s, %s", str(e), str(data))
return HttpResponseServerError()
return JsonResponse(response)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment