diff --git a/InvenTree/InvenTree/settings.py b/InvenTree/InvenTree/settings.py index f5f5802278..c8a2be70c9 100644 --- a/InvenTree/InvenTree/settings.py +++ b/InvenTree/InvenTree/settings.py @@ -68,7 +68,7 @@ ROOT_URLCONF = 'InvenTree.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], + 'DIRS': [os.path.join(BASE_DIR, 'templates')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ @@ -81,6 +81,8 @@ TEMPLATES = [ }, ] +print(os.path.join(BASE_DIR, 'templates')) + REST_FRAMEWORK = { 'EXCEPTION_HANDLER': 'InvenTree.utils.api_exception_handler' } diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index f08f8da4d8..4c2b8967f5 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -23,7 +23,6 @@ class PartCategory(InvenTreeTree): verbose_name = "Part Category" verbose_name_plural = "Part Categories" - @property def partcount(self): """ Return the total part count under this category diff --git a/InvenTree/part/templates/part/category_delete.html b/InvenTree/part/templates/part/category_delete.html index 960edbbaa1..7814317356 100644 --- a/InvenTree/part/templates/part/category_delete.html +++ b/InvenTree/part/templates/part/category_delete.html @@ -18,7 +18,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 %} |