From 544e217347dead6b7bd3246759f91e0788675c45 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Fri, 5 Jun 2020 11:52:07 +1000 Subject: [PATCH] Add page to show stock which is assigned to a customer --- .../templates/company/assigned_stock.html | 29 +++++++++++++++++++ InvenTree/company/templates/company/tabs.html | 7 +++++ InvenTree/company/urls.py | 13 +++++---- InvenTree/templates/js/stock.html | 2 -- 4 files changed, 43 insertions(+), 8 deletions(-) create mode 100644 InvenTree/company/templates/company/assigned_stock.html diff --git a/InvenTree/company/templates/company/assigned_stock.html b/InvenTree/company/templates/company/assigned_stock.html new file mode 100644 index 0000000000..53bc79b054 --- /dev/null +++ b/InvenTree/company/templates/company/assigned_stock.html @@ -0,0 +1,29 @@ +{% extends "company/company_base.html" %} +{% load static %} +{% load i18n %} + +{% block details %} + +{% include "company/tabs.html" with tab="assigned" %} + +

{% trans "Assigned Stock" %}

+
+ +
+ +{% endblock %} + +{% block js_ready %} +{{ block.super }} + +loadStockTable($("#stock-table"), { + params: { + test: 7, + customer: {{ company.id }}, + part_detail: true, + location_detail: true, + }, + url: "{% url 'api-stock-list' %}", +}); + +{% endblock %} \ No newline at end of file diff --git a/InvenTree/company/templates/company/tabs.html b/InvenTree/company/templates/company/tabs.html index 9fd00ceb11..ebd646b741 100644 --- a/InvenTree/company/templates/company/tabs.html +++ b/InvenTree/company/templates/company/tabs.html @@ -21,6 +21,13 @@ {% trans "Sales Orders" %} {{ company.sales_orders.count }} + + {% trans "Assigned Stock" %} + + {{ company.assigned_stock.count }} + + + {% endif %} {% trans "Notes" %}{% if company.notes %} {% endif %} diff --git a/InvenTree/company/urls.py b/InvenTree/company/urls.py index af8e1846e1..f5fbeede47 100644 --- a/InvenTree/company/urls.py +++ b/InvenTree/company/urls.py @@ -13,13 +13,14 @@ company_detail_urls = [ # url(r'orders/?', views.CompanyDetail.as_view(template_name='company/orders.html'), name='company-detail-orders'), - url(r'parts/', views.CompanyDetail.as_view(template_name='company/detail_part.html'), name='company-detail-parts'), - url(r'stock/?', views.CompanyDetail.as_view(template_name='company/detail_stock.html'), name='company-detail-stock'), - url(r'purchase-orders/?', views.CompanyDetail.as_view(template_name='company/purchase_orders.html'), name='company-detail-purchase-orders'), - url(r'sales-orders/?', views.CompanyDetail.as_view(template_name='company/sales_orders.html'), name='company-detail-sales-orders'), - url(r'notes/?', views.CompanyNotes.as_view(), name='company-notes'), + url(r'^parts/', views.CompanyDetail.as_view(template_name='company/detail_part.html'), name='company-detail-parts'), + url(r'^stock/', views.CompanyDetail.as_view(template_name='company/detail_stock.html'), name='company-detail-stock'), + url(r'^purchase-orders/', views.CompanyDetail.as_view(template_name='company/purchase_orders.html'), name='company-detail-purchase-orders'), + url(r'^assigned-stock/', views.CompanyDetail.as_view(template_name='company/assigned_stock.html'), name='company-detail-assigned-stock'), + url(r'^sales-orders/', views.CompanyDetail.as_view(template_name='company/sales_orders.html'), name='company-detail-sales-orders'), + url(r'^notes/', views.CompanyNotes.as_view(), name='company-notes'), - url(r'thumbnail/?', views.CompanyImage.as_view(), name='company-image'), + url(r'^thumbnail/', views.CompanyImage.as_view(), name='company-image'), # Any other URL url(r'^.*$', views.CompanyDetail.as_view(), name='company-detail'), diff --git a/InvenTree/templates/js/stock.html b/InvenTree/templates/js/stock.html index c0737dc250..14be8d9afe 100644 --- a/InvenTree/templates/js/stock.html +++ b/InvenTree/templates/js/stock.html @@ -351,8 +351,6 @@ function loadStockTable(table, options) { loc = "{% trans "Undefined location" %}"; } - console.log("Location: " + loc); - if (!locations.includes(loc)) { locations.push(loc); }