do not change transactions date when validating/deleting credit-soge (and typo)

This commit is contained in:
bleizi 2023-07-09 11:23:33 +02:00
parent 201a179947
commit 3c99b0f3e9
No known key found for this signature in database
GPG Key ID: D46D7E3364433208
1 changed files with 3 additions and 5 deletions

View File

@ -1,4 +1,4 @@
# Copyright (C) 2018-2021 by BDE ENS Paris-Saclay
# Copyright (C) 2018-2023 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
from datetime import date
@ -326,7 +326,7 @@ class SogeCredit(models.Model):
if self.valid or not self.pk:
return
# Soge do not pay BDE and kfet memberships this year (2022-2023)
# Soge do not pay BDE and kfet memberships since 2022
# bde = Club.objects.get(name="BDE")
# kfet = Club.objects.get(name="Kfet")
# bde_qs = Membership.objects.filter(user=self.user, club=bde, date_start__gte=bde.membership_start)
@ -388,7 +388,6 @@ class SogeCredit(models.Model):
for tr in self.transactions.all():
tr.valid = True
tr._force_save = True
tr.created_at = timezone.now()
tr.save()
@transaction.atomic
@ -437,12 +436,11 @@ class SogeCredit(models.Model):
for tr in self.transactions.all():
tr._force_save = True
tr.valid = True
tr.created_at = timezone.now()
tr.save()
if self.credit_transaction:
# If the soge credit is deleted while the user is not validated yet,
# there is not credit transaction.
# There is a credit transaction iff the user declares that no bank account
# There is a credit transaction if the user declares that no bank account
# was opened after the validation of the account.
self.credit_transaction.valid = False
self.credit_transaction.reason += " (invalide)"