From c931ec9fa01565aa4002129c33f611e8ef8e7a4b Mon Sep 17 00:00:00 2001 From: grisel-davy Date: Sun, 18 Oct 2020 17:36:10 +0200 Subject: [PATCH] Add number of article in the display of cotisation --- cotisations/models.py | 10 ++++++++++ cotisations/templates/cotisations/aff_profil.html | 14 ++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) 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 %}