mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
merge statments
This commit is contained in:
parent
306725ef92
commit
d5bcd256f6
@ -789,21 +789,20 @@ class BomImportExtractSerializer(DataFileExtractSerializer):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
# No direct match, where else can we look?
|
# No direct match, where else can we look?
|
||||||
if part is None:
|
if part is None and (part_name or part_ipn):
|
||||||
if part_name or part_ipn:
|
queryset = Part.objects.all()
|
||||||
queryset = Part.objects.all()
|
|
||||||
|
|
||||||
if part_name:
|
if part_name:
|
||||||
queryset = queryset.filter(name=part_name)
|
queryset = queryset.filter(name=part_name)
|
||||||
|
|
||||||
if part_ipn:
|
if part_ipn:
|
||||||
queryset = queryset.filter(IPN=part_ipn)
|
queryset = queryset.filter(IPN=part_ipn)
|
||||||
|
|
||||||
if queryset.exists():
|
if queryset.exists():
|
||||||
if queryset.count() == 1:
|
if queryset.count() == 1:
|
||||||
part = queryset.first()
|
part = queryset.first()
|
||||||
else:
|
else:
|
||||||
row['errors']['part'] = _('Multiple matching parts found')
|
row['errors']['part'] = _('Multiple matching parts found')
|
||||||
|
|
||||||
if part is None:
|
if part is None:
|
||||||
row['errors']['part'] = _('No matching part found')
|
row['errors']['part'] = _('No matching part found')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user