forked from DGNum/gestioCOF
cleaner fix
This commit is contained in:
parent
df467767f4
commit
7989a07b5f
1 changed files with 4 additions and 5 deletions
|
@ -2305,16 +2305,17 @@ class AccountStatOperation(ScaleMixin, PkUrlMixin, JSONDetailView):
|
||||||
context_object_name = 'account'
|
context_object_name = 'account'
|
||||||
id_prefix = ""
|
id_prefix = ""
|
||||||
|
|
||||||
def get_operations(self, types, scale):
|
def get_operations(self, scale, types=None):
|
||||||
# On selectionne les opérations qui correspondent
|
# On selectionne les opérations qui correspondent
|
||||||
# à l'article en question et qui ne sont pas annulées
|
# à l'article en question et qui ne sont pas annulées
|
||||||
# puis on choisi pour chaques intervalle les opérations
|
# puis on choisi pour chaques intervalle les opérations
|
||||||
# effectuées dans ces intervalles de temps
|
# effectuées dans ces intervalles de temps
|
||||||
all_operations = (Operation.objects
|
all_operations = (Operation.objects
|
||||||
.filter(type__in=types)
|
|
||||||
.filter(group__on_acc=self.object)
|
.filter(group__on_acc=self.object)
|
||||||
.filter(canceled_at=None)
|
.filter(canceled_at=None)
|
||||||
)
|
)
|
||||||
|
if types is not None:
|
||||||
|
all_operations = all_operations.filter(type__in==types)
|
||||||
chunks = self.chunkify_qs(all_operations, scale, field='group__at')
|
chunks = self.chunkify_qs(all_operations, scale, field='group__at')
|
||||||
return chunks
|
return chunks
|
||||||
|
|
||||||
|
@ -2324,9 +2325,7 @@ class AccountStatOperation(ScaleMixin, PkUrlMixin, JSONDetailView):
|
||||||
scale = self.scale
|
scale = self.scale
|
||||||
|
|
||||||
types = self.request.GET.get('types', None)
|
types = self.request.GET.get('types', None)
|
||||||
if types is None:
|
if types is not None:
|
||||||
types = []
|
|
||||||
else:
|
|
||||||
types = ast.literal_eval(types)
|
types = ast.literal_eval(types)
|
||||||
|
|
||||||
operations = self.get_operations(types=types, scale=scale)
|
operations = self.get_operations(types=types, scale=scale)
|
||||||
|
|
Loading…
Reference in a new issue