diff --git a/cotisations/migrations/0030_custom_payment.py b/cotisations/migrations/0030_custom_payment.py index 847da608..6cf74f22 100644 --- a/cotisations/migrations/0030_custom_payment.py +++ b/cotisations/migrations/0030_custom_payment.py @@ -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), diff --git a/cotisations/models.py b/cotisations/models.py index 8b6d5a8c..7b4fcab3 100644 --- a/cotisations/models.py +++ b/cotisations/models.py @@ -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): """ diff --git a/cotisations/payment_methods/balance/models.py b/cotisations/payment_methods/balance/models.py index 4a80fea7..8c328279 100644 --- a/cotisations/payment_methods/balance/models.py +++ b/cotisations/payment_methods/balance/models.py @@ -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, diff --git a/cotisations/payment_methods/cheque/models.py b/cotisations/payment_methods/cheque/models.py index bdb4e594..c2680e7a 100644 --- a/cotisations/payment_methods/cheque/models.py +++ b/cotisations/payment_methods/cheque/models.py @@ -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, diff --git a/cotisations/payment_methods/comnpay/models.py b/cotisations/payment_methods/comnpay/models.py index 0801df3b..ff6fed0d 100644 --- a/cotisations/payment_methods/comnpay/models.py +++ b/cotisations/payment_methods/comnpay/models.py @@ -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, diff --git a/cotisations/templates/cotisations/aff_paiement.html b/cotisations/templates/cotisations/aff_paiement.html index 91049a3f..e42d512f 100644 --- a/cotisations/templates/cotisations/aff_paiement.html +++ b/cotisations/templates/cotisations/aff_paiement.html @@ -30,6 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,