diff --git a/cotisations/models.py b/cotisations/models.py index 2e71d418..ac75760b 100644 --- a/cotisations/models.py +++ b/cotisations/models.py @@ -96,6 +96,16 @@ class BaseInvoice(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model): ) return name + def name_detailed(self): + """ + Return: + - a list of strings with the name of all article in the invoice + and their quantity. + """ + ventes = self.vente_set.all() + strings = ["{} x {}".format(v.number, v.name) for v in ventes] + return strings + # TODO : change facture to invoice class Facture(BaseInvoice): diff --git a/cotisations/templates/cotisations/aff_profil.html b/cotisations/templates/cotisations/aff_profil.html index 7e01a93a..a6e21624 100644 --- a/cotisations/templates/cotisations/aff_profil.html +++ b/cotisations/templates/cotisations/aff_profil.html @@ -85,7 +85,17 @@ with this program; if not, write to the Free Software Foundation, Inc., {% for facture in facture_list %} {{ facture.user }} - {{ facture.name }} + + + {% for article in facture.name_detailed %} + + + + {% endfor %} +
+ {{ article }} +
+ {{ facture.prix_total }} {{ facture.paiement }} {{ facture.date }} @@ -115,7 +125,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% endif %} - + {% endfor %}