Skip to content
Snippets Groups Projects
Verified Commit b597a6ac authored by ynerant's avatar ynerant
Browse files

Fix soge credit deletion when the account is not validated yet


Signed-off-by: ynerant's avatarYohann D'ANELLO <ynerant@crans.org>
parent a704b92c
No related branches found
No related tags found
2 merge requests!152Fix soge credit deletion when the account is not validated yet,!151Fix soge credit deletion when the account is not validated yet
Pipeline #8873 passed with stages
in 9 minutes and 2 seconds
This commit is part of merge request !152. Comments created here will be created in the context of that merge request.
......@@ -381,9 +381,14 @@ class SogeCredit(models.Model):
tr.valid = True
tr.created_at = timezone.now()
tr.save()
self.credit_transaction.valid = False
self.credit_transaction.reason += " (invalide)"
self.credit_transaction.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
# 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)
class Meta:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment