mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 04:55:44 +00:00
Improvements to company API
- Filter by is_manufacturer - Better table display
This commit is contained in:
@ -43,9 +43,10 @@ class CompanyList(generics.ListCreateAPIView):
|
||||
]
|
||||
|
||||
filter_fields = [
|
||||
'name',
|
||||
'is_customer',
|
||||
'is_manufacturer',
|
||||
'is_supplier',
|
||||
'name',
|
||||
]
|
||||
|
||||
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_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):
|
||||
""" Get string representation of a Company """
|
||||
|
@ -49,9 +49,10 @@ class CompanySerializer(InvenTreeModelSerializer):
|
||||
'contact',
|
||||
'link',
|
||||
'image',
|
||||
'notes',
|
||||
'is_customer',
|
||||
'is_manufacturer',
|
||||
'is_supplier',
|
||||
'notes',
|
||||
'part_count'
|
||||
]
|
||||
|
||||
|
@ -46,7 +46,21 @@ InvenTree | {% trans "Supplier List" %}
|
||||
title: '{% trans "Supplier" %}',
|
||||
sortable: true,
|
||||
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'),
|
||||
|
||||
# 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'),
|
||||
]
|
||||
|
||||
|
Reference in New Issue
Block a user