mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-11-27 02:43:01 +00:00
Fix soge credit deletion when the account is not validated yet
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
parent
a704b92c3d
commit
b597a6ac5b
@ -381,9 +381,14 @@ class SogeCredit(models.Model):
|
|||||||
tr.valid = True
|
tr.valid = True
|
||||||
tr.created_at = timezone.now()
|
tr.created_at = timezone.now()
|
||||||
tr.save()
|
tr.save()
|
||||||
self.credit_transaction.valid = False
|
if self.credit_transaction:
|
||||||
self.credit_transaction.reason += " (invalide)"
|
# If the soge credit is deleted while the user is not validated yet,
|
||||||
self.credit_transaction.save()
|
# there is not credit transaction.
|
||||||
|
# There is a credit transaction iff 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)"
|
||||||
|
self.credit_transaction.save()
|
||||||
super().delete(**kwargs)
|
super().delete(**kwargs)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
Loading…
Reference in New Issue
Block a user