From e5789dbe0337d3499fab98e8332ec08fbb248d81 Mon Sep 17 00:00:00 2001 From: Hugo LEVY-FALK Date: Fri, 13 Jul 2018 22:28:10 +0200 Subject: [PATCH] Fix le paiement par cheque --- cotisations/payment_methods/cheque/views.py | 3 ++- cotisations/views.py | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cotisations/payment_methods/cheque/views.py b/cotisations/payment_methods/cheque/views.py index 47654990..4d164a79 100644 --- a/cotisations/payment_methods/cheque/views.py +++ b/cotisations/payment_methods/cheque/views.py @@ -30,6 +30,7 @@ from django.contrib import messages from django.utils.translation import ugettext as _ from cotisations.models import Facture as Invoice +from cotisations.utils import find_payment_method from .models import ChequePayment from .forms import InvoiceForm @@ -39,7 +40,7 @@ from .forms import InvoiceForm def cheque(request, invoice_pk): """This view validate an invoice with the data from a cheque.""" invoice = get_object_or_404(Invoice, pk=invoice_pk) - payment_method = getattr(invoice.paiement, 'payment_method', None) + payment_method = find_payment_method(invoice.paiement) if invoice.valid or not isinstance(payment_method, ChequePayment): messages.error( request, diff --git a/cotisations/views.py b/cotisations/views.py index e738e2c4..61533105 100644 --- a/cotisations/views.py +++ b/cotisations/views.py @@ -479,7 +479,6 @@ def edit_paiement(request, paiement_instance, **_kwargs): 'title': _("Edit payment method") }, 'cotisations/facture.html', request) - 'title': _("New payment method") # TODO : change paiement to payment @login_required