2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 11:10:54 +00:00

Merge remote-tracking branch 'inventree/master'

This commit is contained in:
Oliver Walters
2020-04-16 21:55:59 +10:00
47 changed files with 920 additions and 198 deletions

View File

@ -344,6 +344,7 @@ class StockList(generics.ListCreateAPIView):
data = queryset.values(
'pk',
'uid',
'parent',
'quantity',
'serial',
@ -540,7 +541,7 @@ class StockList(generics.ListCreateAPIView):
'supplier_part',
'customer',
'belongs_to',
'build'
'build',
]

View File

@ -0,0 +1,18 @@
# Generated by Django 2.2.10 on 2020-04-14 12:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('stock', '0025_auto_20200405_2243'),
]
operations = [
migrations.AddField(
model_name='stockitem',
name='uid',
field=models.CharField(blank=True, help_text='Unique identifier field', max_length=128),
),
]

View File

@ -44,11 +44,11 @@ class StockLocation(InvenTreeTree):
""" Return a JSON string for formatting a barcode for this StockLocation object """
return helpers.MakeBarcode(
'StockLocation',
self.id,
reverse('api-location-detail', kwargs={'pk': self.id}),
'stocklocation',
{
'name': self.name,
"id": self.id,
"name": self.name,
"url": reverse('api-location-detail', kwargs={'pk': self.id}),
}
)
@ -108,6 +108,7 @@ class StockItem(MPTTModel):
Attributes:
parent: Link to another StockItem from which this StockItem was created
uid: Field containing a unique-id which is mapped to a third-party identifier (e.g. a barcode)
part: Link to the master abstract part that this StockItem is an instance of
supplier_part: Link to a specific SupplierPart (optional)
location: Where this StockItem is located
@ -288,15 +289,15 @@ class StockItem(MPTTModel):
"""
return helpers.MakeBarcode(
'StockItem',
self.id,
reverse('api-stock-detail', kwargs={'pk': self.id}),
"stockitem",
{
'part_id': self.part.id,
'part_name': self.part.full_name
"id": self.id,
"url": reverse('api-stock-detail', kwargs={'pk': self.id}),
}
)
uid = models.CharField(blank=True, max_length=128, help_text=("Unique identifier field"))
parent = TreeForeignKey('self',
on_delete=models.DO_NOTHING,
blank=True, null=True,

View File

@ -39,6 +39,7 @@ class StockItemSerializerBrief(InvenTreeModelSerializer):
model = StockItem
fields = [
'pk',
'uid',
'part',
'part_name',
'supplier_part',
@ -106,6 +107,7 @@ class StockItemSerializer(InvenTreeModelSerializer):
'status',
'status_text',
'tracking_items',
'uid',
'url',
]

View File

@ -85,7 +85,7 @@
</tr>
{% if item.belongs_to %}
<tr>
<td></td>
<td><span class='fas fa-box'></span></td>
<td>{% trans "Belongs To" %}</td>
<td><a href="{% url 'stock-item-detail' item.belongs_to.id %}">{{ item.belongs_to }}</a></td>
</tr>
@ -96,6 +96,13 @@
<td><a href="{% url 'stock-location-detail' item.location.id %}">{{ item.location.name }}</a></td>
</tr>
{% endif %}
{% if item.uid %}
<tr>
<td><span class='fas fa-barcode'></span></td>
<td>{% trans "Unique Identifier" %}</td>
<td>{{ item.uid }}</td>
</tr>
{% endif %}
{% if item.serialized %}
<tr>
<td></td>