diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index 4c221e92b9..0a5b1652e4 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -739,7 +739,10 @@ class StockItem(MPTTModel): self.add_tracking_entry( StockHistoryCode.CONVERTED_TO_VARIANT, user, - notes=notes + deltas={ + 'part': variant.pk, + }, + notes=_('Converted to part') + ': ' + variant.full_name, ) def get_item_owner(self): diff --git a/InvenTree/stock/views.py b/InvenTree/stock/views.py index 079f9c2dc9..5781f69db7 100644 --- a/InvenTree/stock/views.py +++ b/InvenTree/stock/views.py @@ -643,6 +643,16 @@ class StockItemConvert(AjaxUpdateView): form.fields['part'].queryset = item.part.get_conversion_options() return form + + def save(self, obj, form): + + stock_item = self.get_object() + + variant = form.cleaned_data.get('part', None) + + stock_item.convert_to_variant(variant, user=self.request.user) + + return stock_item class StockLocationCreate(AjaxCreateView):