1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-21 01:48:21 +02:00

Fix membership dates for new memberships, fix tests

Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
2021-10-04 18:15:07 +02:00
parent 9628560d64
commit 69bb38297f
2 changed files with 10 additions and 4 deletions

View File

@ -413,6 +413,12 @@ class Membership(models.Model):
"""
Calculate fee and end date before saving the membership and creating the transaction if needed.
"""
# Ensure that club membership dates are valid
old_membership_start = self.club.membership_start
self.club.update_membership_dates()
if self.club.membership_start != old_membership_start:
self.club.save()
created = not self.pk
if not created:
for role in self.roles.all():