2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-02 03:30:54 +00:00

Merge branch 'master' of https://github.com/inventree/InvenTree into instance-name-in-title

This commit is contained in:
2021-04-17 12:19:38 +02:00
60 changed files with 2579 additions and 218 deletions

View File

@ -48,7 +48,7 @@ from rest_framework import generics, filters, permissions
class StockCategoryTree(TreeSerializer):
title = 'Stock'
title = _('Stock')
model = StockLocation
@property
@ -774,7 +774,7 @@ class StockList(generics.ListCreateAPIView):
company = params.get('company', None)
if company is not None:
queryset = queryset.filter(Q(supplier_part__supplier=company) | Q(supplier_part__manufacturer=company))
queryset = queryset.filter(Q(supplier_part__supplier=company) | Q(supplier_part__manufacturer_part__manufacturer=company))
# Filter by supplier
supplier = params.get('supplier', None)
@ -786,7 +786,7 @@ class StockList(generics.ListCreateAPIView):
manufacturer = params.get('manufacturer', None)
if manufacturer is not None:
queryset = queryset.filter(supplier_part__manufacturer=manufacturer)
queryset = queryset.filter(supplier_part__manufacturer_part__manufacturer=manufacturer)
"""
Filter by the 'last updated' date of the stock item(s):

View File

@ -344,6 +344,8 @@ class StockItem(MPTTModel):
"stockitem",
self.id,
{
"request": kwargs.get('request', None),
"item_url": reverse('stock-item-detail', kwargs={'pk': self.id}),
"url": reverse('api-stock-detail', kwargs={'pk': self.id}),
},
**kwargs

View File

@ -84,7 +84,7 @@ class StockItemSerializer(InvenTreeModelSerializer):
'sales_order',
'supplier_part',
'supplier_part__supplier',
'supplier_part__manufacturer',
'supplier_part__manufacturer_part__manufacturer',
'allocations',
'sales_order_allocations',
'location',

View File

@ -331,9 +331,21 @@
<td><a href="{{ item.link }}">{{ item.link }}</a></td>
</tr>
{% endif %}
{% if item.supplier_part %}
{% if item.supplier_part.manufacturer_part %}
<tr>
<td><span class='fas fa-industry'></span></td>
<td>{% trans "Manufacturer" %}</td>
<td><a href="{% url 'company-detail' item.supplier_part.manufacturer_part.manufacturer.id %}">{{ item.supplier_part.manufacturer_part.manufacturer.name }}</a></td>
</tr>
<tr>
<td><span class='fas fa-hashtag'></span></td>
<td>{% trans "Manufacturer Part" %}</td>
<td><a href="{% url 'manufacturer-part-detail' item.supplier_part.manufacturer_part.id %}">{{ item.supplier_part.manufacturer_part.MPN }}</a></td>
</tr>
{% endif %}
{% if item.supplier_part %}
<tr>
<td><span class='fas fa-building'></span></td>
<td>{% trans "Supplier" %}</td>
<td><a href="{% url 'company-detail' item.supplier_part.supplier.id %}">{{ item.supplier_part.supplier.name }}</a></td>
</tr>