diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index 005b6aa44a..f89837b7a0 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -26,13 +26,18 @@ class StockLocation(InvenTreeTree): class StockItem(models.Model): 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) + location = models.ForeignKey(StockLocation, on_delete=models.CASCADE) + quantity = models.PositiveIntegerField(validators=[MinValueValidator(0)]) + updated = models.DateField(auto_now=True) # last time the stock was checked / counted stocktake_date = models.DateField(blank=True, null=True) + stocktake_user = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True) review_needed = models.BooleanField(default=False) diff --git a/InvenTree/stock/templates/stock/detail.html b/InvenTree/stock/templates/stock/detail.html new file mode 100644 index 0000000000..e9b758c8d2 --- /dev/null +++ b/InvenTree/stock/templates/stock/detail.html @@ -0,0 +1,21 @@ +{% extends "base.html" %} + +{% block content %} + +{% include "stock/loc_link.html" with location=item.location %} + +
Item | Part | Stock | Stocktake | @@ -25,6 +26,7 @@
---|---|---|---|
Click here | {{ item.part.name }} | {{ item.quantity }} | {{ item.stocktake_date }} | diff --git a/InvenTree/stock/views.py b/InvenTree/stock/views.py index 32e47f2830..64dd293b84 100644 --- a/InvenTree/stock/views.py +++ b/InvenTree/stock/views.py @@ -38,6 +38,6 @@ def index(request): 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}) \ No newline at end of file + return render(request, 'stock/detail.html', {'item' : stock}) \ No newline at end of file