From 55b533d3efcdc98e275137c20113a89819650b58 Mon Sep 17 00:00:00 2001
From: Oliver
{% for cat in category.children.all %}
-
{% endif %}
@@ -33,7 +33,7 @@ Are you sure you want to delete category '{{ category.name }}'?
Link | Quantity | Location | Supplier part | @@ -18,8 +19,9 @@ Total in stock: {{ part.stock }}||
---|---|---|---|---|---|
Click | {{ stock.quantity }} | -{{ stock.location.name }} | +{{ stock.location.name }} | {% if stock.supplier_part %} @@ -31,6 +33,12 @@ Total in stock: {{ part.stock }} | {{ stock.notes }} |
Supplier | SKU | +Supplier | URL | ||||
---|---|---|---|---|---|---|---|
{{ spart.supplier.name }} | {{ spart.SKU }} | +{{ spart.supplier.name }} |
{% if spart.URL %}
{{ spart.URL }}
diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py
index 146943e1b0..32fca52124 100644
--- a/InvenTree/stock/models.py
+++ b/InvenTree/stock/models.py
@@ -20,6 +20,9 @@ class StockLocation(InvenTreeTree):
Stock locations can be heirarchical as required
"""
+ def get_absolute_url(self):
+ return '/stock/location/{id}/'.format(id=self.id)
+
@property
def items(self):
stock_list = self.stockitem_set.all()
@@ -34,7 +37,16 @@ def before_delete_stock_location(sender, instance, using, **kwargs):
item.location = instance.parent
item.save()
+ # Update each child category
+ for child in instance.children.all():
+ child.parent = instance.parent
+ child.save()
+
class StockItem(models.Model):
+
+ def get_absolute_url(self):
+ return '/stock/item/{id}/'.format(id=self.id)
+
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)
diff --git a/InvenTree/stock/templates/stock/item.html b/InvenTree/stock/templates/stock/item.html
index 8b7c80e5f9..1f4e63cdb4 100644
--- a/InvenTree/stock/templates/stock/item.html
+++ b/InvenTree/stock/templates/stock/item.html
@@ -4,10 +4,12 @@
{% include "stock/loc_link.html" with location=item.location %}
+Stock entry details+
This location contains {{ location.children.all|length }} child locations.
This location contains {{ location.items.all|length }} stock items.
| ||||
{{ item.part.name }} | +{{ item.part.name }} | {{ item.quantity }} | {{ item.status }} | {{ item.stocktake_date }} | diff --git a/InvenTree/stock/urls.py b/InvenTree/stock/urls.py index c83646429b..3712c6f2d6 100644 --- a/InvenTree/stock/urls.py +++ b/InvenTree/stock/urls.py @@ -52,10 +52,10 @@ stock_urls = [ url(r'^location/new/', views.StockLocationCreate.as_view(), name='stock-location-create'), + url(r'^item/new/?', views.StockItemCreate.as_view(), name='stock-item-create'), + # Individual stock items url(r'^item/(?PPart | {% if part.part %} - {{ part.part.name }} + {{ part.part.name }} {% endif %} |