mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add 'detail' view for stock item
This commit is contained in:
parent
89ee09b01f
commit
ce854e3119
@ -26,13 +26,18 @@ class StockLocation(InvenTreeTree):
|
|||||||
|
|
||||||
class StockItem(models.Model):
|
class StockItem(models.Model):
|
||||||
part = models.ForeignKey(Part, on_delete=models.CASCADE, related_name='locations')
|
part = models.ForeignKey(Part, on_delete=models.CASCADE, related_name='locations')
|
||||||
|
|
||||||
supplier_part = models.ForeignKey(SupplierPart, blank=True, null=True, on_delete=models.SET_NULL)
|
supplier_part = models.ForeignKey(SupplierPart, blank=True, null=True, on_delete=models.SET_NULL)
|
||||||
|
|
||||||
location = models.ForeignKey(StockLocation, on_delete=models.CASCADE)
|
location = models.ForeignKey(StockLocation, on_delete=models.CASCADE)
|
||||||
|
|
||||||
quantity = models.PositiveIntegerField(validators=[MinValueValidator(0)])
|
quantity = models.PositiveIntegerField(validators=[MinValueValidator(0)])
|
||||||
|
|
||||||
updated = models.DateField(auto_now=True)
|
updated = models.DateField(auto_now=True)
|
||||||
|
|
||||||
# last time the stock was checked / counted
|
# last time the stock was checked / counted
|
||||||
stocktake_date = models.DateField(blank=True, null=True)
|
stocktake_date = models.DateField(blank=True, null=True)
|
||||||
|
|
||||||
stocktake_user = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True)
|
stocktake_user = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True)
|
||||||
|
|
||||||
review_needed = models.BooleanField(default=False)
|
review_needed = models.BooleanField(default=False)
|
||||||
|
21
InvenTree/stock/templates/stock/detail.html
Normal file
21
InvenTree/stock/templates/stock/detail.html
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
{% include "stock/loc_link.html" with location=item.location %}
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Part: <a href="{% url 'part-detail' item.part.id %}">{{ item.part.name }}</a></li>
|
||||||
|
{% if item.supplier_part %}
|
||||||
|
<li>Supplier Part: {{ item.supplier_part.supplier.name }} | {{ item.supplier_part.SKU }}</li>
|
||||||
|
{% endif %}
|
||||||
|
<li>Quantity: {{ item.quantity }}</li>
|
||||||
|
{% if item.stocktake_date %}
|
||||||
|
<li>Stocktake Date: {{ item.stocktake_date }}</li>
|
||||||
|
<li>Checked by: {{ item.stocktake_user }}</li>
|
||||||
|
{% endif %}
|
||||||
|
<li>Status: {{ item.status }}</li>
|
||||||
|
<li>Notes: {{ item.notes }}</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -18,6 +18,7 @@
|
|||||||
{% if items|length > 0 %}
|
{% if items|length > 0 %}
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th>Item</th>
|
||||||
<th>Part</th>
|
<th>Part</th>
|
||||||
<th>Stock</th>
|
<th>Stock</th>
|
||||||
<th>Stocktake</th>
|
<th>Stocktake</th>
|
||||||
@ -25,6 +26,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{% for item in items %}
|
{% for item in items %}
|
||||||
<tr>
|
<tr>
|
||||||
|
<td><a href="{% url 'stock-detail' item.id %}">Click here</a></td>
|
||||||
<td><a href="{% url 'part-detail' item.part.id %}">{{ item.part.name }}</a></td>
|
<td><a href="{% url 'part-detail' item.part.id %}">{{ item.part.name }}</a></td>
|
||||||
<td>{{ item.quantity }}</td>
|
<td>{{ item.quantity }}</td>
|
||||||
<td>{{ item.stocktake_date }}</td>
|
<td>{{ item.stocktake_date }}</td>
|
||||||
|
@ -38,6 +38,6 @@ def index(request):
|
|||||||
|
|
||||||
def detail(request, pk):
|
def detail(request, pk):
|
||||||
|
|
||||||
item = get_object_or_404(Stock, pk=pk)
|
stock = get_object_or_404(StockItem, pk=pk)
|
||||||
|
|
||||||
return render(request, 'stock/detail.html', {'item' : item})
|
return render(request, 'stock/detail.html', {'item' : stock})
|
Loading…
Reference in New Issue
Block a user