Browse Source

Add comment in invoices

Fabs 10 years ago
parent
commit
c00e20733d
1 changed files with 9 additions and 1 deletions
  1. 9 1
      coin/billing/create_subscriptions_invoices.py

+ 9 - 1
coin/billing/create_subscriptions_invoices.py

@@ -7,6 +7,7 @@ from dateutil.relativedelta import relativedelta
 from django.http import HttpResponse
 from django.db import transaction
 from django.db.models import Q
+from django.core.exceptions import ObjectDoesNotExist
 from coin.offers.models import Offer, OfferSubscription
 from coin.members.models import Member
 from coin.billing.models import Invoice, InvoiceDetail
@@ -135,7 +136,14 @@ def create_member_invoice_for_a_period(member, date):
             if period_from < period_to:
                 # Ajout l'item de l'offre correspondant à l'abonnement
                 # à la facture
-                invoice.details.create(label=offer.name,
+                label = offer.name
+                try:
+                    if (offer_subscription.configuration.comment):
+                        label += " (%s)" % offer_subscription.configuration.comment
+                except ObjectDoesNotExist:
+                    pass
+
+                invoice.details.create(label=label,
                                        amount=offer.period_fees,
                                        quantity=quantity,
                                        offersubscription=offer_subscription,