mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-15 11:35:41 +00:00
Only add company data if part is purchaseable
This commit is contained in:
@ -733,9 +733,7 @@ class PartList(generics.ListCreateAPIView):
|
||||
stock_item.save(user=request.user)
|
||||
|
||||
# Optionally add manufacturer / supplier data to the part
|
||||
add_supplier_info = str2bool(request.data.get('add_supplier_info', False))
|
||||
|
||||
if add_supplier_info:
|
||||
if part.purchaseable and str2bool(request.data.get('add_supplier_info', False)):
|
||||
|
||||
try:
|
||||
manufacturer = Company.objects.get(pk=request.data.get('manufacturer', None))
|
||||
@ -780,7 +778,7 @@ class PartList(generics.ListCreateAPIView):
|
||||
'SKU': [_("This field is required")]
|
||||
})
|
||||
|
||||
supplier_part = SupplierPart.objects.create(
|
||||
SupplierPart.objects.create(
|
||||
part=part,
|
||||
supplier=supplier,
|
||||
SKU=sku,
|
||||
|
Reference in New Issue
Block a user