From 89ee09b01fa0aa1814bd07ac011a52a2e84e6dd1 Mon Sep 17 00:00:00 2001 From: Oliver Date: Sat, 14 Apr 2018 15:13:16 +1000 Subject: [PATCH] Implemented bidirectional traversal for PART and STOCK apps - Added list view for StockItems --- InvenTree/InvenTree/urls.py | 11 +++-- InvenTree/part/templates/base.html | 3 +- .../part/templates/{part => }/navbar.html | 0 InvenTree/part/templates/part/bom.html | 2 +- InvenTree/part/templates/part/cat_link.html | 4 +- InvenTree/part/templates/part/detail.html | 6 +-- InvenTree/part/templates/part/index.html | 31 ++++++------- InvenTree/part/templates/part/part_base.html | 2 +- InvenTree/part/templates/part/stock.html | 2 +- InvenTree/part/urls.py | 12 +++--- InvenTree/part/views.py | 12 ++++-- InvenTree/stock/templates/stock/index.html | 38 ++++++++++++++++ InvenTree/stock/templates/stock/loc_link.html | 9 ++++ InvenTree/stock/urls.py | 20 ++++++++- InvenTree/stock/views.py | 43 +++++++++++++++++++ 15 files changed, 157 insertions(+), 38 deletions(-) rename InvenTree/part/templates/{part => }/navbar.html (100%) create mode 100644 InvenTree/stock/templates/stock/index.html create mode 100644 InvenTree/stock/templates/stock/loc_link.html diff --git a/InvenTree/InvenTree/urls.py b/InvenTree/InvenTree/urls.py index 8ff3f19bac..f5b3b94f9b 100644 --- a/InvenTree/InvenTree/urls.py +++ b/InvenTree/InvenTree/urls.py @@ -6,7 +6,11 @@ from rest_framework.documentation import include_docs_urls from part.urls import part_api_urls, part_cat_api_urls from part.urls import bom_api_urls from part.urls import part_urls -from stock.urls import stock_urls, stock_loc_urls + + +from stock.urls import stock_api_urls, stock_api_loc_urls +from stock.urls import stock_urls + from supplier.urls import cust_urls, manu_urls, supplier_part_urls, price_break_urls, supplier_urls from django.conf import settings @@ -24,8 +28,8 @@ admin.site.site_header = "InvenTree Admin" apipatterns = [ # Stock URLs - url(r'^stock/', include(stock_urls)), - url(r'^stock-location/', include(stock_loc_urls)), + url(r'^stock/', include(stock_api_urls)), + url(r'^stock-location/', include(stock_api_loc_urls)), # Part URLs url(r'^part/', include(part_api_urls)), @@ -63,6 +67,7 @@ urlpatterns = [ url(r'^api/', include(apipatterns)), url(r'^part/', include(part_urls)), + url(r'^stock/', include(stock_urls)), url(r'^api-doc/', include_docs_urls(title='InvenTree API')), diff --git a/InvenTree/part/templates/base.html b/InvenTree/part/templates/base.html index 034144f171..326a683758 100644 --- a/InvenTree/part/templates/base.html +++ b/InvenTree/part/templates/base.html @@ -20,7 +20,8 @@ InvenTree - {% include "part/navbar.html" %} +{% include "navbar.html" %} + {% block content %} {% endblock %} diff --git a/InvenTree/part/templates/part/navbar.html b/InvenTree/part/templates/navbar.html similarity index 100% rename from InvenTree/part/templates/part/navbar.html rename to InvenTree/part/templates/navbar.html diff --git a/InvenTree/part/templates/part/bom.html b/InvenTree/part/templates/part/bom.html index 01795ed71c..96db339db6 100644 --- a/InvenTree/part/templates/part/bom.html +++ b/InvenTree/part/templates/part/bom.html @@ -11,7 +11,7 @@ {% for bom_item in part.bom_items.all %} {% with sub_part=bom_item.sub_part %} - {{ sub_part.name }} + {{ sub_part.name }} {{ sub_part.description }} {{ bom_item.quantity }} diff --git a/InvenTree/part/templates/part/cat_link.html b/InvenTree/part/templates/part/cat_link.html index b227797339..4ac0471217 100644 --- a/InvenTree/part/templates/part/cat_link.html +++ b/InvenTree/part/templates/part/cat_link.html @@ -1,7 +1,9 @@
-All > +Parts > +{% if category %} {% for path_item in category.parentpath %} {{ path_item.name }} > {% endfor %} {{ category.name }} +{% endif %}
\ No newline at end of file diff --git a/InvenTree/part/templates/part/detail.html b/InvenTree/part/templates/part/detail.html index 87de3e0b9e..6e34cc4fd9 100644 --- a/InvenTree/part/templates/part/detail.html +++ b/InvenTree/part/templates/part/detail.html @@ -3,15 +3,15 @@ {% block details %}
-There are {{ part.bomItemCount }} BOM items for this part. +There are {{ part.bomItemCount }} BOM items for this part.
Used in {{ part.usedInCount }} other parts.
-There are {{ part.stock }} units in stock. +There are {{ part.stock }} units in stock.

{% if part.trackable %} -Part tracking +Part tracking {% else %} {{ part.name }} does not have part tracking enabled {% endif %} diff --git a/InvenTree/part/templates/part/index.html b/InvenTree/part/templates/part/index.html index f9458b56ce..69d197de2b 100644 --- a/InvenTree/part/templates/part/index.html +++ b/InvenTree/part/templates/part/index.html @@ -2,32 +2,33 @@ {% block content %} -

Parts page!

- -{% if category %} {% include "part/cat_link.html" with category=category %} -

Child categories

-