mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add 'barcode_hash' data to more API serializers: (#3906)
* Add 'barcode_hash' data to more API serializers: - part - stock location - supplier part * Bump API version * Make 'barcode_hash' fields read-only via the API * Fix for Part serializer
This commit is contained in:
parent
0c0e61432d
commit
92260f2059
@ -2,11 +2,16 @@
|
||||
|
||||
|
||||
# InvenTree API version
|
||||
INVENTREE_API_VERSION = 79
|
||||
INVENTREE_API_VERSION = 80
|
||||
|
||||
"""
|
||||
Increment this API version number whenever there is a significant change to the API that any clients need to know about
|
||||
|
||||
v80 -> 2022-11-07 : https://github.com/inventree/InvenTree/pull/3906
|
||||
- Adds 'barcode_hash' to Part API serializer
|
||||
- Adds 'barcode_hash' to StockLocation API serializer
|
||||
- Adds 'barcode_hash' to SupplierPart API serializer
|
||||
|
||||
v79 -> 2022-11-03 : https://github.com/inventree/InvenTree/pull/3895
|
||||
- Add metadata to Company
|
||||
|
||||
|
@ -294,6 +294,7 @@ class SupplierPartSerializer(InvenTreeModelSerializer):
|
||||
'MPN',
|
||||
'note',
|
||||
'pk',
|
||||
'barcode_hash',
|
||||
'packaging',
|
||||
'pack_size',
|
||||
'part',
|
||||
@ -307,6 +308,7 @@ class SupplierPartSerializer(InvenTreeModelSerializer):
|
||||
|
||||
read_only_fields = [
|
||||
'availability_updated',
|
||||
'barcode_hash',
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
|
@ -285,6 +285,7 @@ class PartBriefSerializer(InvenTreeModelSerializer):
|
||||
fields = [
|
||||
'pk',
|
||||
'IPN',
|
||||
'barcode_hash',
|
||||
'default_location',
|
||||
'name',
|
||||
'revision',
|
||||
@ -301,6 +302,10 @@ class PartBriefSerializer(InvenTreeModelSerializer):
|
||||
'units',
|
||||
]
|
||||
|
||||
read_only_fields = [
|
||||
'barcode_hash',
|
||||
]
|
||||
|
||||
|
||||
class PartSerializer(RemoteImageMixin, InvenTreeModelSerializer):
|
||||
"""Serializer for complete detail information of a part.
|
||||
@ -430,6 +435,7 @@ class PartSerializer(RemoteImageMixin, InvenTreeModelSerializer):
|
||||
'allocated_to_build_orders',
|
||||
'allocated_to_sales_orders',
|
||||
'assembly',
|
||||
'barcode_hash',
|
||||
'category',
|
||||
'category_detail',
|
||||
'component',
|
||||
@ -467,6 +473,10 @@ class PartSerializer(RemoteImageMixin, InvenTreeModelSerializer):
|
||||
'virtual',
|
||||
]
|
||||
|
||||
read_only_fields = [
|
||||
'barcode_hash',
|
||||
]
|
||||
|
||||
def save(self):
|
||||
"""Save the Part instance"""
|
||||
|
||||
|
@ -65,6 +65,10 @@ class StockItemSerializerBrief(InvenTree.serializers.InvenTreeModelSerializer):
|
||||
'barcode_hash',
|
||||
]
|
||||
|
||||
read_only_fields = [
|
||||
'barcode_hash',
|
||||
]
|
||||
|
||||
def validate_serial(self, value):
|
||||
"""Make sure serial is not to big."""
|
||||
if abs(extract_int(value)) > 0x7fffffff:
|
||||
@ -258,6 +262,7 @@ class StockItemSerializer(InvenTree.serializers.InvenTreeModelSerializer):
|
||||
"""
|
||||
read_only_fields = [
|
||||
'allocated',
|
||||
'barcode_hash',
|
||||
'stocktake_date',
|
||||
'stocktake_user',
|
||||
'updated',
|
||||
@ -602,6 +607,7 @@ class LocationSerializer(InvenTree.serializers.InvenTreeModelSerializer):
|
||||
model = StockLocation
|
||||
fields = [
|
||||
'pk',
|
||||
'barcode_hash',
|
||||
'url',
|
||||
'name',
|
||||
'level',
|
||||
@ -613,6 +619,10 @@ class LocationSerializer(InvenTree.serializers.InvenTreeModelSerializer):
|
||||
'icon',
|
||||
]
|
||||
|
||||
read_only_fields = [
|
||||
'barcode_hash',
|
||||
]
|
||||
|
||||
|
||||
class StockItemAttachmentSerializer(InvenTree.serializers.InvenTreeAttachmentSerializer):
|
||||
"""Serializer for StockItemAttachment model."""
|
||||
|
Loading…
Reference in New Issue
Block a user