Commit 337c8dd8 authored by Levy--Falk Hugo's avatar Levy--Falk Hugo

Ajoute l'affichage du moyen de paiement personnalisé dans la liste des paiements.

parent 0ceead79
......@@ -95,6 +95,7 @@ class Migration(migrations.Migration):
('payment', models.OneToOneField(editable=False, on_delete=django.db.models.deletion.CASCADE, related_name='payment_method', to='cotisations.Paiement')),
],
bases=(cotisations.payment_methods.mixins.PaymentMethodMixin, models.Model),
options={'verbose_name': 'Cheque'},
),
migrations.CreateModel(
name='ComnpayPayment',
......@@ -106,6 +107,7 @@ class Migration(migrations.Migration):
('minimum_payment', models.DecimalField(decimal_places=2, default=1, help_text='The minimal amount of money you have to use when paying with ComNpay', max_digits=5, verbose_name='Minimum payment')),
],
bases=(cotisations.payment_methods.mixins.PaymentMethodMixin, models.Model),
options={'verbose_name': 'ComNpay'},
),
migrations.CreateModel(
name='BalancePayment',
......@@ -116,6 +118,7 @@ class Migration(migrations.Migration):
('maximum_balance', models.DecimalField(decimal_places=2, default=50, help_text='The maximal amount of money allowed for the balance.', max_digits=5, verbose_name='Maximum balance', null=True, blank=True)),
],
bases=(cotisations.payment_methods.mixins.PaymentMethodMixin, models.Model),
options={'verbose_name': 'User Balance'},
),
migrations.RunPython(add_comnpay),
migrations.RunPython(add_cheque),
......
......@@ -716,6 +716,12 @@ class Paiement(RevMixin, AclMixin, models.Model):
return cls.objects.all()
return cls.objects.filter(available_for_everyone=True)
def get_payment_method_name(self):
p = find_payment_method(self)
if p is not None:
return p._meta.verbose_name
return _("No custom payment method")
class Cotisation(RevMixin, AclMixin, models.Model):
"""
......
......@@ -24,7 +24,6 @@ from django.urls import reverse
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_lazy as _l
from django.contrib import messages
from django.forms import ValidationError
from cotisations.models import Paiement
......@@ -35,6 +34,10 @@ class BalancePayment(PaymentMethodMixin, models.Model):
"""
The model allowing you to pay with a cheque.
"""
class Meta:
verbose_name = _l("User Balance")
payment = models.OneToOneField(
Paiement,
on_delete=models.CASCADE,
......
......@@ -21,6 +21,7 @@
from django.db import models
from django.shortcuts import redirect
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _l
from cotisations.models import Paiement
from cotisations.payment_methods.mixins import PaymentMethodMixin
......@@ -30,6 +31,10 @@ class ChequePayment(PaymentMethodMixin, models.Model):
"""
The model allowing you to pay with a cheque.
"""
class Meta:
verbose_name = _l("Cheque")
payment = models.OneToOneField(
Paiement,
on_delete=models.CASCADE,
......
......@@ -35,6 +35,10 @@ class ComnpayPayment(PaymentMethodMixin, models.Model):
"""
The model allowing you to pay with COMNPAY.
"""
class Meta:
verbose_name = "ComNpay"
payment = models.OneToOneField(
Paiement,
on_delete=models.CASCADE,
......
......@@ -30,6 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<tr>
<th>{% trans "Payment type" %}</th>
<th>{% trans "Is available for everyone" %}</th>
<th>{% trans "Custom payment method" %}</th>
<th></th>
</tr>
</thead>
......@@ -37,6 +38,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<tr>
<td>{{ paiement.moyen }}</td>
<td>{{ paiement.available_for_everyone }}</td>
<td>
{{paiement.get_payment_method_name}}
</td>
<td class="text-right">
{% can_edit paiement %}
<a class="btn btn-primary btn-sm" role="button" title="{% trans "Edit" %}" href="{% url 'cotisations:edit-paiement' paiement.id %}">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment