8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-24 04:13:12 +00:00

Create new method to return number + name and add to template

This commit is contained in:
grisel-davy 2020-09-10 15:15:31 +02:00 committed by chirac
parent d2ee39359f
commit 777621fcec
2 changed files with 9 additions and 1 deletions

View file

@ -95,6 +95,14 @@ class BaseInvoice(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
Vente.objects.filter(facture=self).values_list("name", flat=True) Vente.objects.filter(facture=self).values_list("name", flat=True)
) )
return name return name
def name_detailled(self):
"""
Return: a string with the name of the article and the number
of article sold.
"""
vente = Vente.objects.filter(facture=self).get()
return str(vente.number) + " x " + str(vente.name)
# TODO : change facture to invoice # TODO : change facture to invoice

View file

@ -59,7 +59,7 @@ 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>{{ facture.name_detailled }}</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>