1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-11-26 18:37:12 +00:00

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

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 # SPDX-License-Identifier: GPL-3.0-or-later
from datetime import date from datetime import date
@ -326,7 +326,7 @@ class SogeCredit(models.Model):
if self.valid or not self.pk: if self.valid or not self.pk:
return 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") # bde = Club.objects.get(name="BDE")
# kfet = Club.objects.get(name="Kfet") # kfet = Club.objects.get(name="Kfet")
# bde_qs = Membership.objects.filter(user=self.user, club=bde, date_start__gte=bde.membership_start) # 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(): for tr in self.transactions.all():
tr.valid = True tr.valid = True
tr._force_save = True tr._force_save = True
tr.created_at = timezone.now()
tr.save() tr.save()
@transaction.atomic @transaction.atomic
@ -437,12 +436,11 @@ class SogeCredit(models.Model):
for tr in self.transactions.all(): for tr in self.transactions.all():
tr._force_save = True tr._force_save = True
tr.valid = True tr.valid = True
tr.created_at = timezone.now()
tr.save() tr.save()
if self.credit_transaction: if self.credit_transaction:
# If the soge credit is deleted while the user is not validated yet, # If the soge credit is deleted while the user is not validated yet,
# there is not credit transaction. # 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. # was opened after the validation of the account.
self.credit_transaction.valid = False self.credit_transaction.valid = False
self.credit_transaction.reason += " (invalide)" self.credit_transaction.reason += " (invalide)"