diff --git a/InvenTree/stock/api.py b/InvenTree/stock/api.py index 5bd11ef196..571c856857 100644 --- a/InvenTree/stock/api.py +++ b/InvenTree/stock/api.py @@ -61,11 +61,15 @@ class StockDetail(generics.RetrieveUpdateDestroyAPIView): def get_serializer(self, *args, **kwargs): - part_detail = str2bool(self.request.GET.get('part_detail', False)) - loc_detail = str2bool(self.request.GET.get('location_detail', False)) + try: + kwargs['part_detail'] = str2bool(self.request.GET.get('part_detail', False)) + except AttributeError: + pass - kwargs['part_detail'] = part_detail - kwargs['location_detail'] = loc_detail + try: + kwargs['location_detail'] = str2bool(self.request.GET.get('location_detail', False)) + except AttributeError: + pass kwargs['context'] = self.get_serializer_context() diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index f6ccd04121..554fb00495 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -427,7 +427,7 @@ class StockItem(MPTTModel): quantity=self.quantity, date=datetime.now().date(), notes=notes, - URL=url, + link=url, system=system ) diff --git a/InvenTree/stock/views.py b/InvenTree/stock/views.py index 4ac415ef23..24c61fd89b 100644 --- a/InvenTree/stock/views.py +++ b/InvenTree/stock/views.py @@ -934,7 +934,7 @@ class StockItemCreate(AjaxCreateView): batch=form_data.get('batch'), delete_on_deplete=False, status=form_data.get('status'), - URL=form_data.get('URL'), + link=form_data.get('link'), ) item.save(user=request.user)