8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-28 18:03:45 +00:00

Add number of article in the display of cotisation

This commit is contained in:
grisel-davy 2020-10-18 17:36:10 +02:00 committed by Gabriel Detraz
parent af3da1eafb
commit bf749fb638
2 changed files with 22 additions and 2 deletions

View file

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

View file

@ -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>