mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 21:15:41 +00:00
@ -309,7 +309,7 @@ class BuildAllocationItemSerializer(serializers.Serializer):
|
||||
)
|
||||
|
||||
def validate_bom_item(self, bom_item):
|
||||
|
||||
|
||||
# TODO: Fix this validation - allow for variants and substitutes!
|
||||
|
||||
build = self.context['build']
|
||||
@ -332,7 +332,7 @@ class BuildAllocationItemSerializer(serializers.Serializer):
|
||||
|
||||
if not stock_item.in_stock:
|
||||
raise ValidationError(_("Item must be in stock"))
|
||||
|
||||
|
||||
return stock_item
|
||||
|
||||
quantity = serializers.DecimalField(
|
||||
@ -398,7 +398,7 @@ class BuildAllocationItemSerializer(serializers.Serializer):
|
||||
|
||||
# Output *cannot* be set for un-tracked parts
|
||||
if output is not None and not bom_item.sub_part.trackable:
|
||||
|
||||
|
||||
raise ValidationError({
|
||||
'output': _('Build output cannot be specified for allocation of untracked parts')
|
||||
})
|
||||
@ -422,14 +422,14 @@ class BuildAllocationSerializer(serializers.Serializer):
|
||||
"""
|
||||
Validation
|
||||
"""
|
||||
|
||||
|
||||
super().validate(data)
|
||||
|
||||
items = data.get('items', [])
|
||||
|
||||
if len(items) == 0:
|
||||
raise ValidationError(_('Allocation items must be provided'))
|
||||
|
||||
|
||||
return data
|
||||
|
||||
def save(self):
|
||||
|
Reference in New Issue
Block a user