Browse Source

Add number of article in the display of cotisation

release-2.9
grisel-davy 5 years ago
committed by Gabriel Detraz
parent
commit
bf749fb638
  1. 10
      cotisations/models.py
  2. 14
      cotisations/templates/cotisations/aff_profil.html

10
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):

14
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 %}
<tr>
<td><a href="{% url 'users:profil' userid=facture.user.id %}">{{ facture.user }}</a></td>
<td>{{ facture.name }}</td>
<td>
<table class="table-striped">
{% for article in facture.name_detailed %}
<tr>
<td>
{{ article }}
</td>
</tr>
{% endfor %}
</table>
</td>
<td>{{ facture.prix_total }}</td>
<td>{{ facture.paiement }}</td>
<td>{{ facture.date }}</td>
@ -115,7 +125,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</a>
{% endif %}
</td>
</tr>
</tr>
{% endfor %}
</table>

Loading…
Cancel
Save