Remove incorrect validation routine

This commit is contained in:
Oliver 2022-02-07 14:24:40 +11:00
parent 11f541303b
commit 55ff026696

View File

@ -492,22 +492,6 @@ class BomItemSerializer(InvenTreeModelSerializer):
purchase_price_range = serializers.SerializerMethodField() purchase_price_range = serializers.SerializerMethodField()
def validate(self, data):
# Check for duplicate BOM items
part = data['part']
sub_part = data['sub_part']
if BomItem.objects.filter(part=part, sub_part=sub_part).exists():
raise serializers.ValidationError({
'part': _("Duplicate BOM item already exists"),
'sub_part': _("Duplicate BOM items already exists"),
})
data = super().validate(data)
return data
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
# part_detail and sub_part_detail serializers are only included if requested. # part_detail and sub_part_detail serializers are only included if requested.
# This saves a bunch of database requests # This saves a bunch of database requests