mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Improvements to company API
- Filter by is_manufacturer
- Better table display
(cherry picked from commit f427ee4754
)
This commit is contained in:
parent
906ed7f64d
commit
094a0fe709
@ -43,9 +43,10 @@ class CompanyList(generics.ListCreateAPIView):
|
|||||||
]
|
]
|
||||||
|
|
||||||
filter_fields = [
|
filter_fields = [
|
||||||
'name',
|
|
||||||
'is_customer',
|
'is_customer',
|
||||||
|
'is_manufacturer',
|
||||||
'is_supplier',
|
'is_supplier',
|
||||||
|
'name',
|
||||||
]
|
]
|
||||||
|
|
||||||
search_fields = [
|
search_fields = [
|
||||||
|
18
InvenTree/company/migrations/0016_auto_20200412_2330.py
Normal file
18
InvenTree/company/migrations/0016_auto_20200412_2330.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 2.2.10 on 2020-04-12 23:30
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('company', '0015_company_is_manufacturer'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='company',
|
||||||
|
name='is_manufacturer',
|
||||||
|
field=models.BooleanField(default=False, help_text='Does this company manufacture parts?'),
|
||||||
|
),
|
||||||
|
]
|
@ -112,7 +112,7 @@ class Company(models.Model):
|
|||||||
|
|
||||||
is_supplier = models.BooleanField(default=True, help_text=_('Do you purchase items from this company?'))
|
is_supplier = models.BooleanField(default=True, help_text=_('Do you purchase items from this company?'))
|
||||||
|
|
||||||
is_manufacturer = models.BooleanField(default=True, help_text=_('Does this company manufacture parts?'))
|
is_manufacturer = models.BooleanField(default=False, help_text=_('Does this company manufacture parts?'))
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
""" Get string representation of a Company """
|
""" Get string representation of a Company """
|
||||||
|
@ -49,9 +49,10 @@ class CompanySerializer(InvenTreeModelSerializer):
|
|||||||
'contact',
|
'contact',
|
||||||
'link',
|
'link',
|
||||||
'image',
|
'image',
|
||||||
'notes',
|
|
||||||
'is_customer',
|
'is_customer',
|
||||||
|
'is_manufacturer',
|
||||||
'is_supplier',
|
'is_supplier',
|
||||||
|
'notes',
|
||||||
'part_count'
|
'part_count'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -46,7 +46,21 @@ InvenTree | {% trans "Supplier List" %}
|
|||||||
title: '{% trans "Supplier" %}',
|
title: '{% trans "Supplier" %}',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
formatter: function(value, row, index, field) {
|
formatter: function(value, row, index, field) {
|
||||||
return imageHoverIcon(row.image) + renderLink(value, row.url);
|
var html = imageHoverIcon(row.image) + renderLink(value, row.url);
|
||||||
|
|
||||||
|
if (row.is_customer) {
|
||||||
|
html += `<span title='Customer' class='fas fa-user label-right'></span>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (row.is_manufacturer) {
|
||||||
|
html += `<span title='Manufacturer' class='fas fa-industry label-right'></span>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (row.is_supplier) {
|
||||||
|
html += `<span title='Supplier' class='fas fa-building label-right'></span>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return html;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,7 @@ company_urls = [
|
|||||||
|
|
||||||
url(r'', views.CompanyIndex.as_view(), name='company-index'),
|
url(r'', views.CompanyIndex.as_view(), name='company-index'),
|
||||||
|
|
||||||
# Redirect any other patterns
|
# Redirect any other patterns to the 'company' index which displays all companies
|
||||||
url(r'^.*$', RedirectView.as_view(url='', permanent=False), name='company-index'),
|
url(r'^.*$', RedirectView.as_view(url='', permanent=False), name='company-index'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -10,8 +10,14 @@
|
|||||||
<li><a href="{% url 'part-index' %}"><span class='fas fa-shapes icon-header'></span> {% trans "Parts" %}</a></li>
|
<li><a href="{% url 'part-index' %}"><span class='fas fa-shapes icon-header'></span> {% trans "Parts" %}</a></li>
|
||||||
<li><a href="{% url 'stock-index' %}"><span class='fas fa-boxes icon-header'></span>{% trans "Stock" %}</a></li>
|
<li><a href="{% url 'stock-index' %}"><span class='fas fa-boxes icon-header'></span>{% trans "Stock" %}</a></li>
|
||||||
<li><a href="{% url 'build-index' %}"><span class='fas fa-tools icon-header'></span>{% trans "Build" %}</a></li>
|
<li><a href="{% url 'build-index' %}"><span class='fas fa-tools icon-header'></span>{% trans "Build" %}</a></li>
|
||||||
<li><a href="{% url 'company-index' %}"><span class='fas fa-industry icon-header'></span>{% trans "Suppliers" %}</a></li>
|
<li class='nav navbar-nav'>
|
||||||
<li><a href="{% url 'po-index' %}"><span class='fas fa-shopping-cart icon-header'></span>{% trans "Orders" %}</a></li>
|
<a class='dropdown-toggle' data-toggle='dropdown' href='#'><span class='fas fa-shopping-cart icon-header'></span>{% trans "Buy" %}</a>
|
||||||
|
<ul class='dropdown-menu'>
|
||||||
|
<li><a href="{% url 'company-index' %}"><span class='fas fa-building icon-header'></span>{% trans "Suppliers" %}</a></li>
|
||||||
|
<li><a href="{% url 'company-index' %}"><span class='fas fa-industry icon-header'></span>{% trans "Manufacturers" %}</a></li>
|
||||||
|
<li><a href="{% url 'po-index' %}"><span class='fas fa-list icon-header'></span>{% trans "Purchase Orders" %}</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="nav navbar-nav navbar-right">
|
<ul class="nav navbar-nav navbar-right">
|
||||||
{% include "search_form.html" %}
|
{% include "search_form.html" %}
|
||||||
|
Loading…
Reference in New Issue
Block a user