forked from DGNum/gestioCOF
Bugfix
Quand un article n'a pas de conso, il a été créé il y a 1s
This commit is contained in:
parent
97cb9d1f3b
commit
f10d6d1a71
1 changed files with 5 additions and 1 deletions
|
@ -2,6 +2,7 @@ import ast
|
||||||
import heapq
|
import heapq
|
||||||
import statistics
|
import statistics
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
from datetime import timedelta
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import List
|
from typing import List
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
|
@ -2523,9 +2524,12 @@ class ArticleStatSalesList(SingleResumeStat):
|
||||||
first_conso = (
|
first_conso = (
|
||||||
Operation.objects.filter(article=self.object)
|
Operation.objects.filter(article=self.object)
|
||||||
.order_by("group__at")
|
.order_by("group__at")
|
||||||
|
.values_list("group__at", flat=True)
|
||||||
.first()
|
.first()
|
||||||
.group.at
|
|
||||||
)
|
)
|
||||||
|
if first_conso is None:
|
||||||
|
# On le crée dans le passé au cas où
|
||||||
|
first_conso = timezone.now() - timedelta(seconds=1)
|
||||||
scales_def = [
|
scales_def = [
|
||||||
("Tout le temps", MonthScale, {"last": True, "begin": first_conso}, False),
|
("Tout le temps", MonthScale, {"last": True, "begin": first_conso}, False),
|
||||||
("1 an", MonthScale, {"last": True, "n_steps": 12}, False),
|
("1 an", MonthScale, {"last": True, "n_steps": 12}, False),
|
||||||
|
|
Loading…
Reference in a new issue