mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
8a1b255b67
@ -15,7 +15,9 @@ InvenTree | {% trans "Supplier List" %}
|
||||
{% if pagetype == 'manufacturers' and roles.purchase_order.add or pagetype == 'suppliers' and roles.purchase_order.add or pagetype == 'customers' and roles.sales_order.add %}
|
||||
<div id='button-toolbar'>
|
||||
<div class='btn-group'>
|
||||
<button type='button' class="btn btn-success" id='new-company'>{{ button_text }}</button>
|
||||
<button type='button' class="btn btn-success" id='new-company'>
|
||||
<span class='fas fa-plus-circle'></span> {{ button_text }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@ -186,18 +186,29 @@ class PartTestTemplateList(generics.ListCreateAPIView):
|
||||
|
||||
|
||||
class PartThumbs(generics.ListAPIView):
|
||||
""" API endpoint for retrieving information on available Part thumbnails """
|
||||
"""
|
||||
API endpoint for retrieving information on available Part thumbnails
|
||||
"""
|
||||
|
||||
queryset = Part.objects.all()
|
||||
serializer_class = part_serializers.PartThumbSerializer
|
||||
|
||||
def get_queryset(self):
|
||||
|
||||
queryset = super().get_queryset()
|
||||
|
||||
# Get all Parts which have an associated image
|
||||
queryset = queryset.exclude(image='')
|
||||
|
||||
return queryset
|
||||
|
||||
def list(self, request, *args, **kwargs):
|
||||
"""
|
||||
Serialize the available Part images.
|
||||
- Images may be used for multiple parts!
|
||||
"""
|
||||
|
||||
# Get all Parts which have an associated image
|
||||
queryset = Part.objects.all().exclude(image='')
|
||||
queryset = self.get_queryset()
|
||||
|
||||
# TODO - We should return the thumbnails here, not the full image!
|
||||
|
||||
|
@ -241,6 +241,17 @@ class PartAPITest(APITestCase):
|
||||
|
||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
def test_get_thumbs(self):
|
||||
"""
|
||||
Return list of part thumbnails
|
||||
"""
|
||||
|
||||
url = reverse('api-part-thumbs')
|
||||
|
||||
response = self.client.get(url)
|
||||
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
|
||||
|
||||
class PartAPIAggregationTest(APITestCase):
|
||||
"""
|
||||
|
@ -1505,8 +1505,10 @@ class StockItemCreate(AjaxCreateView):
|
||||
# form.fields['part'].widget = HiddenInput()
|
||||
|
||||
# Trackable parts get special consideration:
|
||||
form.fields['delete_on_deplete'].disabled = not part.trackable
|
||||
form.fields['serial_numbers'].disabled = not part.trackable
|
||||
if part.trackable:
|
||||
form.fields['delete_on_deplete'].disabled = True
|
||||
else:
|
||||
form.fields['serial_numbers'].disabled = True
|
||||
|
||||
# If the part is NOT purchaseable, hide the supplier_part field
|
||||
if not part.purchaseable:
|
||||
|
@ -18,8 +18,8 @@ django-import-export==2.0.0 # Data import / export for admin interface
|
||||
django-cleanup==4.0.0 # Manage deletion of old / unused uploaded files
|
||||
django-qr-code==1.2.0 # Generate QR codes
|
||||
flake8==3.8.3 # PEP checking
|
||||
coverage==5.2.1 # Unit test coverage
|
||||
python-coveralls==2.9.1 # Coveralls linking (for Travis)
|
||||
coverage==5.3 # Unit test coverage
|
||||
coveralls==2.1.2 # Coveralls linking (for Travis)
|
||||
rapidfuzz==0.7.6 # Fuzzy string matching
|
||||
django-stdimage==5.1.1 # Advanced ImageField management
|
||||
django-tex==1.1.7 # LaTeX PDF export
|
||||
|
Loading…
Reference in New Issue
Block a user