Fix some issues

This commit is contained in:
Yohann D'ANELLO 2020-04-01 04:20:47 +02:00
parent 0df0f3f66b
commit 535c493bc7
3 changed files with 21 additions and 14 deletions

View File

@ -5,7 +5,7 @@ import datetime
from django.conf import settings from django.conf import settings
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.core.exceptions import ValidationError, PermissionDenied from django.core.exceptions import ValidationError
from django.db import models from django.db import models
from django.urls import reverse, reverse_lazy from django.urls import reverse, reverse_lazy
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
@ -246,7 +246,7 @@ class Membership(models.Model):
self.make_transaction() self.make_transaction()
def make_transaction(self): def make_transaction(self):
if self.transaction is not None or not self.fee: if not self.fee or MembershipTransaction.objects.filter(membership=self).exists():
return return
if self.fee: if self.fee:
@ -256,11 +256,14 @@ class Membership(models.Model):
destination=self.club.note, destination=self.club.note,
quantity=1, quantity=1,
amount=self.fee, amount=self.fee,
reason="Adhésion", reason="Adhésion " + self.club.name,
) )
transaction._force_save = True transaction._force_save = True
transaction.save(force_insert=True) transaction.save(force_insert=True)
def __str__(self):
return _("Membership of {user} for the club {club}").format(user=self.user.username, club=self.club.name, )
class Meta: class Meta:
verbose_name = _('membership') verbose_name = _('membership')
verbose_name_plural = _('memberships') verbose_name_plural = _('memberships')

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-04-01 04:00+0200\n" "POT-Creation-Date: 2020-04-01 04:12+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -362,10 +362,15 @@ msgid "User is already a member of the club"
msgstr "" msgstr ""
#: apps/member/models.py:265 #: apps/member/models.py:265
#, python-brace-format
msgid "Membership of {user} for the club {club}"
msgstr ""
#: apps/member/models.py:268
msgid "membership" msgid "membership"
msgstr "" msgstr ""
#: apps/member/models.py:266 #: apps/member/models.py:269
msgid "memberships" msgid "memberships"
msgstr "" msgstr ""
@ -382,7 +387,7 @@ msgid "The membership must start after {:%m-%d-%Y}."
msgstr "" msgstr ""
#: apps/member/views.py:383 apps/member/views.py:415 #: apps/member/views.py:383 apps/member/views.py:415
msgid "The membership must start before {:%m-%d-%Y}." msgid "The membership must begin before {:%m-%d-%Y}."
msgstr "" msgstr ""
#: apps/note/admin.py:120 apps/note/models/transactions.py:94 #: apps/note/admin.py:120 apps/note/models/transactions.py:94

View File

@ -3,7 +3,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-04-01 04:00+0200\n" "POT-Creation-Date: 2020-04-01 04:12+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -362,10 +362,15 @@ msgid "User is already a member of the club"
msgstr "L'utilisateur est déjà membre du club" msgstr "L'utilisateur est déjà membre du club"
#: apps/member/models.py:265 #: apps/member/models.py:265
#, python-brace-format
msgid "Membership of {user} for the club {club}"
msgstr "Adhésion de {user} pour le club {club}"
#: apps/member/models.py:268
msgid "membership" msgid "membership"
msgstr "adhésion" msgstr "adhésion"
#: apps/member/models.py:266 #: apps/member/models.py:269
msgid "memberships" msgid "memberships"
msgstr "adhésions" msgstr "adhésions"
@ -1228,9 +1233,3 @@ msgstr "Il n'y a pas de transaction associée à une remise ouverte."
#: templates/treasury/remittance_list.html:54 #: templates/treasury/remittance_list.html:54
msgid "Closed remittances" msgid "Closed remittances"
msgstr "Remises fermées" msgstr "Remises fermées"
#~ msgid "Add roles"
#~ msgstr "Ajouter des rôles"
#~ msgid "linked notes"
#~ msgstr "notes liées"