Add 'stock' tab for supplier page

This commit is contained in:
Oliver Walters 2019-05-16 21:16:19 +10:00
parent c1224048ad
commit 1b06cd23af
5 changed files with 35 additions and 1 deletions

View File

@ -72,6 +72,11 @@ InvenTree | Company - {{ company.name }}
{% endblock %}
{% block js_load %}
{{ block.super }}
<script type='text/javascript' src="{% static 'script/inventree/stock.js' %}"></script>
{% endblock %}
{% block js_ready %}
enableDragAndDrop(

View File

@ -0,0 +1,25 @@
{% extends "company/company_base.html" %}
{% load static %}
{% block details %}
{% include "company/tabs.html" with tab='stock' %}
<h3>Supplier Stock</h3>
<table class='table table-striped table-condensed' id='stock-table'>
</table>
{% endblock %}
{% block js_ready %}
{{ block.super }}
loadStockTable($('#stock-table'),
{
url: "{% url 'api-stock-list' %}",
params: {
supplier: {{ company.id }},
}
});
{% endblock %}

View File

@ -6,6 +6,9 @@
<li{% if tab == 'parts' %} class='active'{% endif %}>
<a href="{% url 'company-detail-parts' company.id %}">Supplier Parts <span class='badge'>{{ company.part_count }}</span></a>
</li>
<li{% if tab == 'stock' %} class='active'{% endif %}>
<a href="{% url 'company-detail-stock' company.id %}">Stock <span class='badge'>{{ company.stock_count }}</a>
</li>
{% if 0 %}
<li{% if tab == 'po' %} class='active'{% endif %}>
<a href="#">Purchase Orders</a>

View File

@ -16,6 +16,7 @@ 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'thumbnail/?', views.CompanyImage.as_view(), name='company-image'),

View File

@ -242,7 +242,7 @@ class StockList(generics.ListCreateAPIView):
Additional query parameters are available:
- location: Filter stock by location
- category: Filter by parts belonging to a certain category
- supplier: Filter by supplier
- supplier: Filter by supplier
"""
def get_queryset(self):