mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-19 13:35:40 +00:00
Add optional part lookup by "part" field
This commit is contained in:
@ -883,6 +883,16 @@ class BomExtractSerializer(serializers.Serializer):
|
||||
except (ValueError, Part.DoesNotExist):
|
||||
pass
|
||||
|
||||
# Optionally, specify using field "part"
|
||||
if part is None:
|
||||
pk = self.find_matching_data(row, 'part', headers)
|
||||
|
||||
if pk is not None:
|
||||
try:
|
||||
part = Part.objects.get(pk=pk)
|
||||
except (ValueError, Part.DoesNotExist):
|
||||
pass
|
||||
|
||||
if part is None:
|
||||
|
||||
if part_name is not None or part_ipn is not None:
|
||||
@ -900,8 +910,6 @@ class BomExtractSerializer(serializers.Serializer):
|
||||
|
||||
row['part'] = part.pk if part is not None else None
|
||||
|
||||
print("part:", part)
|
||||
|
||||
rows.append(row)
|
||||
|
||||
return {
|
||||
|
Reference in New Issue
Block a user