Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add empty details view for stock records
Marcin Gębala5b9a362b4dbb
diff --git a/saleor/dashboard/product/urls.py b/saleor/dashboard/product/urls.pyindex 7334c929c4..cc31c7fa65 100644--- a/saleor/dashboard/product/urls.py+++ b/saleor/dashboard/product/urls.py@@ -41,6 +41,8 @@ urlpatterns = [url(r'^(?P<product_pk>[0-9]+)/variants/(?P<variant_pk>[0-9]+)/stock/add/$',views.stock_edit, name='variant-stock-add'),url(r'^(?P<product_pk>[0-9]+)/variants/(?P<variant_pk>[0-9]+)/stock/(?P<stock_pk>[0-9]+)/$',+ views.stock_details, name='variant-stock-details'),+ url(r'^(?P<product_pk>[0-9]+)/variants/(?P<variant_pk>[0-9]+)/stock/(?P<stock_pk>[0-9]+)/update/$',views.stock_edit, name='variant-stock-update'),url(r'^(?P<product_pk>[0-9]+)/variants/(?P<variant_pk>[0-9]+)/stock/(?P<stock_pk>[0-9]+)/delete/$',views.stock_delete, name='variant-stock-delete'),diff --git a/saleor/dashboard/product/views.py b/saleor/dashboard/product/views.pyindex 1e71eb6531..07e97e4d78 100644--- a/saleor/dashboard/product/views.py+++ b/saleor/dashboard/product/views.py@@ -203,6 +203,15 @@ def product_delete(request, pk):{'product': product})+def stock_details(request, product_pk, variant_pk, stock_pk):+ product = get_object_or_404(Product, pk=product_pk)+ variant = get_object_or_404(product.variants, pk=variant_pk)+ stock = get_object_or_404(variant.stock, pk=stock_pk)+ ctx = {'stock': stock, 'product': product, 'variant': variant}+ return TemplateResponse(+ request, 'dashboard/product/stock_details.html', ctx)++@staff_member_requireddef stock_edit(request, product_pk, variant_pk, stock_pk=None):product = get_object_or_404(Product, pk=product_pk)diff --git a/templates/dashboard/index.html b/templates/dashboard/index.htmlindex b2e0914665..d0d67922b0 100644--- a/templates/dashboard/index.html+++ b/templates/dashboard/index.html@@ -100,7 +100,7 @@</thead><tbody>{% for product in low_stock %}- <tr data-action-go="{% url "dashboard:product-detail" pk=product.pk %}#stock">+ <tr data-action-go="{% url "dashboard:product-detail" pk=product.pk %}"><td>{{ product }}</td>diff --git a/templates/dashboard/product/stock_details.html b/templates/dashboard/product/stock_details.htmlnew file mode 100644index 0000000000..e69de29bb2diff --git a/templates/dashboard/product/variant_details.html b/templates/dashboard/product/variant_details.htmlindex 694726652d..4937f9e737 100644--- a/templates/dashboard/product/variant_details.html+++ b/templates/dashboard/product/variant_details.html@@ -92,7 +92,7 @@</thead><tbody>{% for stock_item in stock %}- <tr data-action-go="{% url "dashboard:variant-stock-update" product_pk=product.pk variant_pk=variant.pk stock_pk=stock_item.pk %}">+ <tr data-action-go="{% url "dashboard:variant-stock-details" product_pk=product.pk variant_pk=variant.pk stock_pk=stock_item.pk %}"><td class="wide">{{ stock_item.location }}</td><td>{{ stock_item.quantity }}</td><td>{{ stock_item.quantity_allocated }}</td>