mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #843 from SchrodingersGat/api-improvements
Api improvements
This commit is contained in:
commit
a6dab76ff6
17
InvenTree/stock/migrations/0044_auto_20200528_1036.py
Normal file
17
InvenTree/stock/migrations/0044_auto_20200528_1036.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# Generated by Django 3.0.5 on 2020-05-28 10:36
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('stock', '0043_auto_20200525_0420'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterUniqueTogether(
|
||||||
|
name='stockitem',
|
||||||
|
unique_together=set(),
|
||||||
|
),
|
||||||
|
]
|
@ -292,11 +292,6 @@ class StockItem(MPTTModel):
|
|||||||
def get_part_name(self):
|
def get_part_name(self):
|
||||||
return self.part.full_name
|
return self.part.full_name
|
||||||
|
|
||||||
class Meta:
|
|
||||||
unique_together = [
|
|
||||||
('part', 'serial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
def format_barcode(self):
|
def format_barcode(self):
|
||||||
""" Return a JSON string for formatting a barcode for this StockItem.
|
""" Return a JSON string for formatting a barcode for this StockItem.
|
||||||
Can be used to perform lookup of a stockitem using barcode
|
Can be used to perform lookup of a stockitem using barcode
|
||||||
|
@ -104,12 +104,14 @@ class StockItemSerializer(InvenTreeModelSerializer):
|
|||||||
location_detail = LocationBriefSerializer(source='location', many=False, read_only=True)
|
location_detail = LocationBriefSerializer(source='location', many=False, read_only=True)
|
||||||
supplier_part_detail = SupplierPartSerializer(source='supplier_part', many=False, read_only=True)
|
supplier_part_detail = SupplierPartSerializer(source='supplier_part', many=False, read_only=True)
|
||||||
|
|
||||||
tracking_items = serializers.IntegerField(source='tracking_info_count')
|
tracking_items = serializers.IntegerField(source='tracking_info_count', read_only=True, required=False)
|
||||||
|
|
||||||
quantity = serializers.FloatField()
|
quantity = serializers.FloatField()
|
||||||
allocated = serializers.FloatField(source='allocation_count')
|
allocated = serializers.FloatField(source='allocation_count', required=False)
|
||||||
|
|
||||||
required_tests = serializers.IntegerField(source='required_test_count', read_only=True)
|
serial = serializers.IntegerField(required=False)
|
||||||
|
|
||||||
|
required_tests = serializers.IntegerField(source='required_test_count', read_only=True, required=False)
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user