Added Manufacturer parts to search, fixed icons, added manufacturer view in supplier part detail page

This commit is contained in:
eeintech 2021-04-01 10:00:15 -04:00
parent a8b858c824
commit 94574b37ae
9 changed files with 93 additions and 20 deletions

View File

@ -193,7 +193,7 @@ class SupplierPartList(generics.ListCreateAPIView):
queryset = SupplierPart.objects.all().prefetch_related(
'part',
'supplier',
'manufacturer_part',
'manufacturer_part__manufacturer',
)
def get_queryset(self):
@ -291,9 +291,9 @@ class SupplierPartList(generics.ListCreateAPIView):
search_fields = [
'SKU',
'supplier__name',
'manufacturer__name',
'manufacturer_part__manufacturer__name',
'description',
'MPN',
'manufacturer_part__MPN',
'part__name',
'part__description',
]

View File

@ -51,12 +51,12 @@
<col width='25'>
<col>
<tr>
<td><span class='fas fa-building'></span></td>
<td><span class='fas fa-industry'></span></td>
<td>{% trans "Manufacturer" %}</td>
<td>{% include "yesnolabel.html" with value=company.is_manufacturer %}</td>
</tr>
<tr>
<td><span class='fas fa-warehouse'></span></td>
<td><span class='fas fa-building'></span></td>
<td>{% trans "Supplier" %}</td>
<td>{% include 'yesnolabel.html' with value=company.is_supplier %}</td>
</tr>

View File

@ -10,7 +10,7 @@
<li class='list-group-item {% if tab == "suppliers" %}active{% endif %}' title='{% trans "Supplier Parts" %}'>
<a href='{% url "manufacturer-part-suppliers" part.id %}'>
<span class='fas fa-warehouse'></span>
<span class='fas fa-building'></span>
{% trans "Suppliers" %}
</a>
</li>

View File

@ -21,7 +21,7 @@
{% if manufacturer_parts.value == "True" and company.is_manufacturer %}
<li class='list-group-item {% if tab == "manufacturer_parts" %}active{% endif %}' title='{% trans "Manufactured Parts" %}'>
<a href='{% url "company-detail-manufacturer-parts" company.id %}'>
<span class='fas fa-building'></span>
<span class='fas fa-industry'></span>
{% trans "Manufactured Parts" %}
</a>
</li>
@ -29,7 +29,7 @@
{% if company.is_supplier or company.is_manufacturer %}
<li class='list-group-item {% if tab == "supplier_parts" %}active{% endif %}' title='{% trans "Supplied Parts" %}'>
<a href='{% url "company-detail-supplier-parts" company.id %}'>
<span class='fas fa-warehouse'></span>
<span class='fas fa-building'></span>
{% trans "Supplied Parts" %}
</a>
</li>

View File

@ -0,0 +1,43 @@
{% extends "company/supplier_part_base.html" %}
{% load static %}
{% load i18n %}
{% load inventree_extras %}
{% block menubar %}
{% include "company/supplier_part_navbar.html" with tab='manufacturers' %}
{% endblock %}
{% block heading %}
{% trans "Manufacturer Parts" %}
{% endblock %}
{% block details %}
{% setting_object 'PART_ENABLE_MANUFACTURER_PARTS' as manufacturer_parts %}
{% if manufacturer_parts.value == "True" %}
<table class="table table-striped table-condensed" id='manufacturer-table' data-toolbar='#button-toolbar'>
</table>
{% else %}
<div class='alert alert-block alert-warning'>
{% trans "Manufactured parts are disabled. Admin users can enable them in the global settings." %}
</div>
{% endif %}
{% endblock %}
{% block js_ready %}
{{ block.super }}
loadManufacturerPartTable(
"#manufacturer-table",
"{% url 'api-manufacturer-part-list' %}",
{
params: {
part: {{ part.id }},
part_detail: true,
manufacturer_detail: true,
},
}
);
{% endblock %}

View File

@ -1,4 +1,5 @@
{% load i18n %}
{% load inventree_extras %}
<ul class='list-group'>
@ -8,6 +9,16 @@
</a>
</li>
{% setting_object 'PART_ENABLE_MANUFACTURER_PARTS' as manufacturer_parts %}
{% if manufacturer_parts.value == "True" %}
<li class='list-group-item {% if tab == "manufacturers" %}active{% endif %}' title='{% trans "Manufacturer Parts" %}'>
<a href='{% url "supplier-part-manufacturers" part.id %}'>
<span class='fas fa-industry'></span>
{% trans "Manufacturers" %}
</a>
</li>
{% endif %}
<li class='list-group-item {% if tab == "stock" %}active{% endif %}' title='{% trans "Supplier Part Stock" %}'>
<a href='{% url "supplier-part-stock" part.id %}'>
<span class='fas fa-boxes'></span>

View File

@ -72,6 +72,7 @@ manufacturer_part_urls = [
supplier_part_detail_urls = [
url(r'^edit/?', views.SupplierPartEdit.as_view(), name='supplier-part-edit'),
url(r'^manufacturers/', views.SupplierPartDetail.as_view(template_name='company/supplier_part_manufacturers.html'), name='supplier-part-manufacturers'),
url(r'^pricing/', views.SupplierPartDetail.as_view(template_name='company/supplier_part_pricing.html'), name='supplier-part-pricing'),
url(r'^orders/', views.SupplierPartDetail.as_view(template_name='company/supplier_part_orders.html'), name='supplier-part-orders'),
url(r'^stock/', views.SupplierPartDetail.as_view(template_name='company/supplier_part_stock.html'), name='supplier-part-stock'),

View File

@ -73,14 +73,14 @@
{% if manufacturer_parts.value == "True" %}
<li class='list-group-item {% if tab == "manufacturers" %}active{% endif %}' title='{% trans "Manufacturers" %}'>
<a href='{% url "part-manufacturers" part.id %}'>
<span class='menu-tab-icon fas fa-building'></span>
<span class='menu-tab-icon fas fa-industry'></span>
{% trans "Manufacturers" %}
</a>
</li>
{% endif %}
<li class='list-group-item {% if tab == "suppliers" %}active{% endif %}' title='{% trans "Suppliers" %}'>
<a href='{% url "part-suppliers" part.id %}'>
<span class='menu-tab-icon fas fa-warehouse'></span>
<span class='menu-tab-icon fas fa-building'></span>
{% trans "Suppliers" %}
</a>
</li>

View File

@ -2,6 +2,7 @@
{% load static %}
{% load i18n %}
{% load inventree_extras %}
{% block page_title %}
InvenTree | {% trans "Search Results" %}
@ -145,6 +146,24 @@ InvenTree | {% trans "Search Results" %}
],
});
{% setting_object 'PART_ENABLE_MANUFACTURER_PARTS' as manufacturer_parts %}
{% if manufacturer_parts.value == "True" %}
addItem('manufacturer-part', '{% trans "Manufacturer Parts" %}', 'fa-toolbox');
loadManufacturerPartTable(
"#table-manufacturer-part",
"{% url 'api-manufacturer-part-list' %}",
{
params: {
search: "{{ query }}",
part_detail: true,
supplier_detail: true,
manufacturer_detail: true
},
}
);
{% endif %}
addItem('supplier-part', '{% trans "Supplier Parts" %}', 'fa-pallet');
loadSupplierPartTable(
@ -287,6 +306,15 @@ InvenTree | {% trans "Search Results" %}
{% if roles.purchase_order.view or roles.sales_order.view %}
addItemTitle('{% trans "Company" %}');
addItem('manufacturer', '{% trans "Manufacturers" %}', 'fa-industry');
loadCompanyTable('#table-manufacturer', "{% url 'api-company-list' %}", {
params: {
search: "{{ query }}",
is_manufacturer: "true",
}
});
{% if roles.purchase_order.view %}
addItem('supplier', '{% trans "Suppliers" %}', 'fa-building');
@ -305,16 +333,6 @@ InvenTree | {% trans "Search Results" %}
}
});
addItem('manufacturer', '{% trans "Manufacturers" %}', 'fa-industry');
loadCompanyTable('#table-manufacturer', "{% url 'api-company-list' %}", {
params: {
search: "{{ query }}",
is_manufacturer: "true",
}
});
{% endif %}
{% if roles.sales_order.view %}