K-Psul - Fix erreur 500 caisse inexistante
This commit is contained in:
parent
7f8c825c2a
commit
59dcb72542
|
@ -835,28 +835,27 @@ def kpsul_checkout_data(request):
|
|||
pk = request.POST.get('pk', 0)
|
||||
if not pk:
|
||||
pk = 0
|
||||
try:
|
||||
data = (Checkout.objects
|
||||
.annotate(
|
||||
last_statement_by_first_name=F('statements__by__cofprofile__user__first_name'),
|
||||
last_statement_by_last_name=F('statements__by__cofprofile__user__last_name'),
|
||||
last_statement_by_trigramme=F('statements__by__trigramme'),
|
||||
last_statement_balance=F('statements__balance_new'),
|
||||
last_statement_at=F('statements__at'))
|
||||
.values(
|
||||
'id', 'name', 'balance', 'valid_from', 'valid_to',
|
||||
'last_statement_balance', 'last_statement_at',
|
||||
'last_statement_by_trigramme', 'last_statement_by_last_name',
|
||||
'last_statement_by_first_name')
|
||||
.select_related(
|
||||
'statements'
|
||||
'statements__by',
|
||||
'statements__by__cofprofile__user')
|
||||
.filter(pk=pk)
|
||||
.order_by('statements__at')
|
||||
.last())
|
||||
except Checkout.DoesNotExist:
|
||||
raise http404
|
||||
data = (Checkout.objects
|
||||
.annotate(
|
||||
last_statement_by_first_name=F('statements__by__cofprofile__user__first_name'),
|
||||
last_statement_by_last_name=F('statements__by__cofprofile__user__last_name'),
|
||||
last_statement_by_trigramme=F('statements__by__trigramme'),
|
||||
last_statement_balance=F('statements__balance_new'),
|
||||
last_statement_at=F('statements__at'))
|
||||
.values(
|
||||
'id', 'name', 'balance', 'valid_from', 'valid_to',
|
||||
'last_statement_balance', 'last_statement_at',
|
||||
'last_statement_by_trigramme', 'last_statement_by_last_name',
|
||||
'last_statement_by_first_name')
|
||||
.select_related(
|
||||
'statements'
|
||||
'statements__by',
|
||||
'statements__by__cofprofile__user')
|
||||
.filter(pk=pk)
|
||||
.order_by('statements__at')
|
||||
.last())
|
||||
if data is None:
|
||||
raise Http404
|
||||
return JsonResponse(data)
|
||||
|
||||
@teamkfet_required
|
||||
|
|
Loading…
Reference in a new issue