2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-29 12:06:44 +00:00

API fixes related to ManufacturerPart

This commit is contained in:
eeintech 2021-04-30 13:54:56 -04:00
parent c60f4c4f2f
commit 41962ca23a
2 changed files with 6 additions and 5 deletions

View File

@ -131,7 +131,7 @@ class ManufacturerPartList(generics.ListCreateAPIView):
params = self.request.query_params params = self.request.query_params
# Filter by manufacturer # Filter by manufacturer
manufacturer = params.get('company', None) manufacturer = params.get('manufacturer', None)
if manufacturer is not None: if manufacturer is not None:
queryset = queryset.filter(manufacturer=manufacturer) queryset = queryset.filter(manufacturer=manufacturer)

View File

@ -192,10 +192,11 @@ class SupplierPartSerializer(InvenTreeModelSerializer):
manufacturer_id = self.initial_data.get('manufacturer', None) manufacturer_id = self.initial_data.get('manufacturer', None)
MPN = self.initial_data.get('MPN', None) MPN = self.initial_data.get('MPN', None)
if manufacturer_id or MPN: if manufacturer_id and MPN:
kwargs = {'manufacturer': manufacturer_id, kwargs = {
'MPN': MPN, 'manufacturer': manufacturer_id,
} 'MPN': MPN,
}
supplier_part.save(**kwargs) supplier_part.save(**kwargs)
return supplier_part return supplier_part