8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-24 04:13:12 +00:00

feat: Add payment method to deposits

This commit is contained in:
Jean-Romain Garnier 2021-08-07 13:23:06 +02:00
parent dfc58a281e
commit 7b5d21c6b1
6 changed files with 38 additions and 24 deletions

View file

@ -40,14 +40,19 @@ class DepositForm(FormRevMixin, ModelForm):
user = kwargs.pop("user")
super(DepositForm, self).__init__(*args, **kwargs)
if not creation:
self.fields["returned"].label = _("Deposit returned")
if creation:
# During creation, we only need to select the item and payment
# method, no need to add the "returned" checkbox
self.fields = {
"item": self.fields["item"],
"payment_method": self.fields["payment_method"],
}
else:
self.fields = {"item": self.fields["item"]}
self.fields["returned"].label = _("Deposit returned")
class Meta:
model = Deposit
fields = ("item", "returned")
fields = ("item", "payment_method", "returned")
class DepositItemForm(FormRevMixin, ModelForm):

View file

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-08-06 16:33+0200\n"
"POT-Creation-Date: 2021-08-07 13:20+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -31,67 +31,67 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: deposits/forms.py:44
#: deposits/forms.py:51
msgid "Deposit returned"
msgstr "Caution rendue"
#: deposits/forms.py:71
#: deposits/forms.py:76
msgid "Current deposit items"
msgstr "Articles sous cautions actuels"
#: deposits/models.py:51
#: deposits/models.py:52
msgid "date"
msgstr "date"
#: deposits/models.py:52
#: deposits/models.py:53
msgid "returned"
msgstr "rendu"
#: deposits/models.py:54 deposits/models.py:139
#: deposits/models.py:55 deposits/models.py:140
msgid "deposit amount"
msgstr "montant de la caution"
#: deposits/models.py:59 deposits/views.py:113
#: deposits/models.py:60 deposits/views.py:113
msgid "deposit"
msgstr "caution"
#: deposits/models.py:60
#: deposits/models.py:61
msgid "deposits"
msgstr "cautions"
#: deposits/models.py:69
#: deposits/models.py:70
#, python-brace-format
msgid "Deposit from {name} for {item} at {date}, returned"
msgstr "Caution de {name} pour {item} à {date}, rendu"
#: deposits/models.py:76
#: deposits/models.py:77
#, python-brace-format
msgid "Deposit from {name} for {item} at {date}, not yet returned"
msgstr "Caution de {name} pour {item} à {date}, pas encore rendu"
#: deposits/models.py:104
#: deposits/models.py:105
msgid "You don't have the right to view other deposits than yours."
msgstr "Vous n'avez pas le droit de voir les cautions d'autres utilisateurs."
#: deposits/models.py:116
#: deposits/models.py:117
msgid "You don't have the right to view the list of deposits."
msgstr "Vous n'avez pas le droit de voir la liste des cautions."
#: deposits/models.py:136
#: deposits/models.py:137
msgid "designation"
msgstr "désignation"
#: deposits/models.py:144
#: deposits/models.py:145
msgid "deposit item"
msgstr "article"
#: deposits/models.py:145
#: deposits/models.py:146
msgid "deposit items"
msgstr "articles"
#: deposits/templates/deposits/aff_deposit_item.html:31
msgid "Deposit"
msgstr "Caution"
msgid "Deposit item"
msgstr "Article"
#: deposits/templates/deposits/aff_deposit_item.html:32
#: deposits/templates/deposits/aff_deposits.html:37
@ -107,10 +107,14 @@ msgid "Item"
msgstr "Article"
#: deposits/templates/deposits/aff_deposits.html:38
msgid "Payment method"
msgstr "Moyen de paiement"
#: deposits/templates/deposits/aff_deposits.html:39
msgid "Date"
msgstr "Date"
#: deposits/templates/deposits/aff_deposits.html:39
#: deposits/templates/deposits/aff_deposits.html:40
msgid "Returned"
msgstr "Rendu"

View file

@ -1,4 +1,4 @@
# Generated by Django 2.2.18 on 2021-08-06 13:54
# Generated by Django 2.2.18 on 2021-08-07 11:08
from django.conf import settings
from django.db import migrations, models
@ -12,6 +12,7 @@ class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('cotisations', '0004_auto_20210208_1827'),
]
operations = [
@ -37,6 +38,7 @@ class Migration(migrations.Migration):
('returned', models.BooleanField(default=False, verbose_name='returned')),
('deposit_amount', models.DecimalField(decimal_places=2, max_digits=5, verbose_name='deposit amount')),
('item', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='deposits.DepositItem')),
('payment_method', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='cotisations.Paiement')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
],
options={

View file

@ -48,6 +48,7 @@ class Deposit(RevMixin, AclMixin, models.Model):
user = models.ForeignKey("users.User", on_delete=models.PROTECT)
item = models.ForeignKey("DepositItem", on_delete=models.PROTECT)
payment_method = models.ForeignKey("cotisations.Paiement", on_delete=models.PROTECT)
date = models.DateTimeField(auto_now_add=True, verbose_name=_("date"))
returned = models.BooleanField(default=False, verbose_name=_("returned"))
deposit_amount = models.DecimalField(

View file

@ -28,7 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "Deposit" %}</th>
<th>{% trans "Deposit item" %}</th>
<th>{% trans "Amount" %}</th>
<th></th>
</tr>

View file

@ -35,6 +35,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th scope="col">{% trans "User" %}</th>
<th scope="col">{% trans "Item" %}</th>
<th scope="col">{% trans "Amount" %}</th>
<th scope="col">{% trans "Payment method" %}</th>
<th scope="col">{% trans "Date" %}</th>
<th scope="col">{% trans "Returned" %}</th>
<th scope="col"></th>
@ -44,6 +45,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td><a href="{% url 'users:profil' deposit.user.id %}" role="button">{{ deposit.user.get_short_name }}</a></td>
<td>{{ deposit.item.name }}</td>
<td>{{ deposit.deposit_amount }} €</td>
<td>{{ deposit.payment_method.moyen }}</td>
<td>{{ deposit.date }}</td>
{% if deposit.returned %}
<td><i class="fa fa-check" style="color:green"></i></td>