From c441a43a8bcd2775b6712928ae69d81103c3426c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Le=20Moigne?= Date: Tue, 10 Jan 2023 21:40:03 +0100 Subject: [PATCH] link SogeCredit to WEI by creation date instead of civil year --- apps/treasury/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/treasury/models.py b/apps/treasury/models.py index 837d0238..51e2b885 100644 --- a/apps/treasury/models.py +++ b/apps/treasury/models.py @@ -310,8 +310,8 @@ class SogeCredit(models.Model): amount = sum(transaction.total for transaction in self.transactions.all()) if 'wei' in settings.INSTALLED_APPS: from wei.models import WEIMembership - if not WEIMembership.objects.filter(club__weiclub__year=datetime.date.today().year, user=self.user)\ - .exists(): + if not WEIMembership.objects\ + .filter(club__weiclub__year=self.credit_transaction.created_at.year, user=self.user).exists(): # 80 € for people that don't go to WEI amount += 8000 return amount