mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix "supplier parts" tab for Company display
Also PEP fixes
(cherry picked from commit a50ecb24c1
)
This commit is contained in:
@ -10,6 +10,7 @@ from rest_framework import filters
|
||||
from rest_framework import generics, permissions
|
||||
|
||||
from django.conf.urls import url, include
|
||||
from django.db.models import Q
|
||||
|
||||
from InvenTree.helpers import str2bool
|
||||
|
||||
@ -95,6 +96,8 @@ class SupplierPartList(generics.ListCreateAPIView):
|
||||
if company is not None:
|
||||
queryset = queryset.filter(Q(manufacturer=company) | Q(supplier=company))
|
||||
|
||||
return queryset
|
||||
|
||||
def get_serializer(self, *args, **kwargs):
|
||||
|
||||
# Do we wish to include extra detail?
|
||||
@ -177,15 +180,15 @@ supplier_part_api_urls = [
|
||||
url(r'^(?P<pk>\d+)/?', SupplierPartDetail.as_view(), name='api-supplier-part-detail'),
|
||||
|
||||
# Catch anything else
|
||||
url(r'^.*$', SupplierPartList.as_view(), name='api-part-supplier-list'),
|
||||
url(r'^.*$', SupplierPartList.as_view(), name='api-supplier-part-list'),
|
||||
]
|
||||
|
||||
|
||||
company_api_urls = [
|
||||
|
||||
url(r'^part/?', include(supplier_part_api_urls)),
|
||||
url(r'^part/', include(supplier_part_api_urls)),
|
||||
|
||||
url(r'^price-break/?', SupplierPriceBreakList.as_view(), name='api-part-supplier-price'),
|
||||
url(r'^price-break/', SupplierPriceBreakList.as_view(), name='api-part-supplier-price'),
|
||||
|
||||
url(r'^(?P<pk>\d+)/?', CompanyDetail.as_view(), name='api-company-detail'),
|
||||
|
||||
|
Reference in New Issue
Block a user