8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-23 15:33: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
parent ccce9d2de9
commit c931ec9fa0
2 changed files with 22 additions and 2 deletions

View file

@ -96,6 +96,16 @@ class BaseInvoice(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
) )
return name 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 # TODO : change facture to invoice
class Facture(BaseInvoice): 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 %} {% for facture in facture_list %}
<tr> <tr>
<td><a href="{% url 'users:profil' userid=facture.user.id %}">{{ facture.user }}</a></td> <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.prix_total }}</td>
<td>{{ facture.paiement }}</td> <td>{{ facture.paiement }}</td>
<td>{{ facture.date }}</td> <td>{{ facture.date }}</td>