Add "paid" note on invoices if there is no open payment

This commit is contained in:
Raphael Michel
2018-11-23 15:36:17 +01:00
parent b4290384e1
commit a205b01d70

View File

@@ -13,7 +13,7 @@ from django.db.models import Count
from django.dispatch import receiver
from django.utils import timezone
from django.utils.timezone import now
from django.utils.translation import pgettext, ugettext as _
from django.utils.translation import pgettext, pgettext_lazy, ugettext as _
from django_countries.fields import Country
from i18nfield.strings import LazyI18nString
@@ -53,6 +53,8 @@ def build_invoice(invoice: Invoice) -> Invoice:
footer = invoice.event.settings.get('invoice_footer_text', as_type=LazyI18nString)
if open_payment and open_payment.payment_provider:
payment = open_payment.payment_provider.render_invoice_text(invoice.order)
elif invoice.order.status == Order.STATUS_PAID:
return pgettext_lazy('invoice', 'The payment for this invoice has already been received.')
else:
payment = ""