diff --git a/CHANGELOG.md b/CHANGELOG.md index 19ed1679..e2493d1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,15 @@ adhérents ni des cotisations. ## Version ??? - ??/??/???? +## Version 0.13 - 19/02/2023 + +### K-Fêt + +- Rajoute la valeur des inventaires +- Résout les problèmes de négatif ne disparaissant pas +- Affiche son surnom s'il y en a un +- Bugfixes + ## Version 0.12.1 - 03/10/2022 ### K-Fêt diff --git a/kfet/management/commands/sendrappelsnegatifs.py b/kfet/management/commands/sendrappelsnegatifs.py index 58c47d4e..4e2f67c3 100644 --- a/kfet/management/commands/sendrappelsnegatifs.py +++ b/kfet/management/commands/sendrappelsnegatifs.py @@ -19,23 +19,31 @@ class Command(BaseCommand): def handle(self, *args, **options): now = timezone.now() + + # Le premier mail est envoyé après 24h de négatif, puis toutes les semaines first_delay = timedelta(days=1) periodic_delay = timedelta(weeks=1) - accounts_first_mail = ( - AccountNegative.objects.filter(start__lt=now - first_delay) - .filter(last_rappel__isnull=True) - .all() + + # On n'envoie des mails qu'aux comptes qui ont un négatif vraiment actif + # et dont la balance est négative + account_negatives = AccountNegative.objects.filter( + account__balance__lt=0 + ).exclude(end__lte=now) + + accounts_first_mail = account_negatives.filter( + start__lt=now - first_delay, last_rappel__isnull=True ) - accounts_periodic_mail = ( - AccountNegative.objects.filter(last_rappel__isnull=False) - .filter(last_rappel__lt=now - periodic_delay) - .all() + accounts_periodic_mail = account_negatives.filter( + last_rappel__lt=now - periodic_delay ) + for neg in accounts_first_mail: neg.send_rappel() self.stdout.write(f"Mail de rappel pour {neg.account} envoyé avec succès.") + for neg in accounts_periodic_mail: neg.send_rappel() self.stdout.write("Mail de rappel pour {neg.account} envoyé avec succès.") - if (not accounts_first_mail) and (not accounts_periodic_mail): + + if not (accounts_first_mail.exists() or accounts_periodic_mail.exists()): self.stdout.write("Aucun mail à envoyer.") diff --git a/kfet/models.py b/kfet/models.py index 7a0ec777..a71b53cd 100644 --- a/kfet/models.py +++ b/kfet/models.py @@ -260,8 +260,10 @@ class Account(models.Model): elif hasattr(self, "negative"): if self.negative.end is None: self.negative.end = timezone.now() + self.negative.save() elif timezone.now() > self.negative.end + kfet_config.cancel_duration: # Idem: on supprime le négatif après une légère période + # Nécessaire pour se souvenir du négatif après une charge annulée self.negative.delete() class UserHasAccount(Exception): diff --git a/kfet/static/kfet/css/base/misc.css b/kfet/static/kfet/css/base/misc.css index fab1a33a..97c0ee7e 100644 --- a/kfet/static/kfet/css/base/misc.css +++ b/kfet/static/kfet/css/base/misc.css @@ -61,7 +61,7 @@ ul { } .table td.no-padding { - padding:0; + padding:0 !important; } .table thead { diff --git a/kfet/static/kfet/js/history.js b/kfet/static/kfet/js/history.js index 4c2a2664..57829a10 100644 --- a/kfet/static/kfet/js/history.js +++ b/kfet/static/kfet/js/history.js @@ -248,7 +248,7 @@ function KHistory(options = {}) { that.cancel_entry(entry); } if (type == "operation") { - for (let opegroup of data["opegroups_to_update"]) { + for (let opegroup of (data["opegroups_to_update"] || [])) { that.update_opegroup(opegroup) } } diff --git a/kfet/templates/kfet/inventory_read.html b/kfet/templates/kfet/inventory_read.html index 9a9275f8..3b308377 100644 --- a/kfet/templates/kfet/inventory_read.html +++ b/kfet/templates/kfet/inventory_read.html @@ -37,6 +37,12 @@ {% block main %} +
+
+ Les valeurs de stock sont calculées sur la base du prix actuel des articles. +
+
+
Erreur - {% regroup inventoryarts by article.category as category_list %} + {% regroup inventoryarts by article.category.name as category_list %} {% for category in category_list %} - + {% for inventoryart in category.list %} - + {% endfor %} {% endfor %} + + + + + + + +
{{ category.grouper.name }}{{ category.grouper }}
- + {{ inventoryart.article.name }} {{ inventoryart.stock_old }} {{ inventoryart.stock_new }}{{ inventoryart.stock_error }}{{ inventoryart.stock_error }} / {{ inventoryart.amount_error|floatformat:"-2" }} €
Valeurs totales{{ total_amount_old|floatformat:"-2" }} €{{ total_amount_new|floatformat:"-2" }} €{{ total_amount_error|floatformat:"-2" }} €
diff --git a/kfet/templates/kfet/left_account.html b/kfet/templates/kfet/left_account.html index aa22cb03..eee35ca2 100644 --- a/kfet/templates/kfet/left_account.html +++ b/kfet/templates/kfet/left_account.html @@ -31,9 +31,7 @@

{{ account.name|title }}

- {% if account.negative %} + {% if account.negative and account.balance_ukf < 0 %}

Négatif