Page article read

- Ajout de l'historique des prix fournisseurs
- Ajout de l'historique des inventaires
This commit is contained in:
Aurélien Delobelle 2016-08-30 18:56:42 +02:00
parent 8a14643ad4
commit db5734ce70
2 changed files with 84 additions and 9 deletions

View file

@ -6,17 +6,78 @@
{% block content %}
<div class="row">
<div class="col-lg-12">
<div class="btn-group btn-group-lg">
<a class="btn btn-primary" href="{% url 'kfet.article.update' article.pk %}">Modifier</a>
<div class="col-sm-4 col-md-3 col-content-left">
<div class="content-left">
<div class="content-left-top">
<div class="line line-big">{{ article.name }}</div>
<div class="line line-bigsub">{{ article.category }}</div>
<div class="block">
<div class="line">Prix (hors réduc.): {{ article.price }}€</div>
<div class="line">Stock: {{ article.stock }}</div>
<div class="line">En vente: {{ article.is_sold }}</div>
</div>
</div>
<div class="buttons">
<a class="btn btn-primary btn-lg" href="{% url 'kfet.article.update' article.pk %}">
Modifier
</a>
</div>
</div>
</div>
<div class="col-sm-8 col-md-9 col-content-right">
{% include 'kfet/base_messages.html' %}
<div class="content-right">
<div class="content-right-block">
<h2>Historique</h2>
<div class="row">
<div class="col-sm-6">
<h3>Inventaires</h3>
<table class="table">
<thead>
<tr>
<td>Date</td>
<td>Stock</td>
<td>Erreur</td>
</tr>
</thead>
<tbody>
{% for inventoryart in inventoryarts %}
<tr>
<td>{{ inventoryart.inventory.at }}</td>
<td>{{ inventoryart.stock_new }}</td>
<td>{{ inventoryart.stock_error }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="col-sm-6">
<h3>Prix fournisseurs</h3>
<table class="table">
<thead>
<tr>
<td>Date</td>
<td>HT</td>
<td>TVA</td>
<td>Droits</td>
</tr>
</thead>
<tbody>
{% for supplierart in supplierarts %}
<tr>
<td>{{ supplierart.at }}</td>
<td>{{ supplierart.price_HT }}</td>
<td>{{ supplierart.TVA }}</td>
<td>{{ supplierart.rights }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<p>Nom: {{ article.name }}</p>
<p>Catégorie: {{ article.category }}</p>
<p>Prix (hors réduction): {{ article.price }} €</p>
<p>Stock: {{ article.stock }}</p>
<p>En vente: {{ article.is_sold }}</p>
{% endblock %}

View file

@ -603,6 +603,20 @@ class ArticleRead(DetailView):
template_name = 'kfet/article_read.html'
context_object_name = 'article'
def get_context_data(self, **kwargs):
context = super(ArticleRead, self).get_context_data(**kwargs)
inventoryarts = (InventoryArticle.objects
.filter(article = self.object)
.select_related('inventory')
.order_by('-inventory__at'))
context['inventoryarts'] = inventoryarts
supplierarts = (SupplierArticle.objects
.filter(article = self.object)
.select_related('supplier')
.order_by('-at'))
context['supplierarts'] = supplierarts
return context
# Article - Update
class ArticleUpdate(SuccessMessageMixin, UpdateView):