forked from DGNum/gestioCOF
Merge branch 'Aufinal/correction_negatifs' into 'k-fet'
Corrige le négatif total Le système de `balance_offset` (assez obscur par ailleurs) était compté dans la mauvais sens dans le calcul du négatif total. Prend aussi en compte maintenant le statut spécial de `#13`, pour ne pas le ranger avec les négatifs habituels. Fix #104 See merge request !125
This commit is contained in:
commit
202199cc18
1 changed files with 4 additions and 2 deletions
|
@ -490,7 +490,8 @@ class AccountGroupUpdate(UpdateView):
|
||||||
|
|
||||||
class AccountNegativeList(ListView):
|
class AccountNegativeList(ListView):
|
||||||
queryset = (AccountNegative.objects
|
queryset = (AccountNegative.objects
|
||||||
.select_related('account', 'account__cofprofile__user'))
|
.select_related('account', 'account__cofprofile__user')
|
||||||
|
.exclude(account__trigramme='#13'))
|
||||||
template_name = 'kfet/account_negative.html'
|
template_name = 'kfet/account_negative.html'
|
||||||
context_object_name = 'negatives'
|
context_object_name = 'negatives'
|
||||||
|
|
||||||
|
@ -501,12 +502,13 @@ class AccountNegativeList(ListView):
|
||||||
'overdraft_duration': Settings.OVERDRAFT_DURATION(),
|
'overdraft_duration': Settings.OVERDRAFT_DURATION(),
|
||||||
}
|
}
|
||||||
negs_sum = (AccountNegative.objects
|
negs_sum = (AccountNegative.objects
|
||||||
|
.exclude(account__trigramme='#13')
|
||||||
.aggregate(
|
.aggregate(
|
||||||
bal = Coalesce(Sum('account__balance'),0),
|
bal = Coalesce(Sum('account__balance'),0),
|
||||||
offset = Coalesce(Sum('balance_offset'),0),
|
offset = Coalesce(Sum('balance_offset'),0),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
context['negatives_sum'] = negs_sum['bal'] + negs_sum['offset']
|
context['negatives_sum'] = negs_sum['bal'] - negs_sum['offset']
|
||||||
return context
|
return context
|
||||||
|
|
||||||
# -----
|
# -----
|
||||||
|
|
Loading…
Reference in a new issue