mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Update stock item variant conversion form to use new function
This commit is contained in:
parent
87de7e4beb
commit
48170ee096
@ -739,7 +739,10 @@ class StockItem(MPTTModel):
|
|||||||
self.add_tracking_entry(
|
self.add_tracking_entry(
|
||||||
StockHistoryCode.CONVERTED_TO_VARIANT,
|
StockHistoryCode.CONVERTED_TO_VARIANT,
|
||||||
user,
|
user,
|
||||||
notes=notes
|
deltas={
|
||||||
|
'part': variant.pk,
|
||||||
|
},
|
||||||
|
notes=_('Converted to part') + ': ' + variant.full_name,
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_item_owner(self):
|
def get_item_owner(self):
|
||||||
|
@ -643,6 +643,16 @@ class StockItemConvert(AjaxUpdateView):
|
|||||||
form.fields['part'].queryset = item.part.get_conversion_options()
|
form.fields['part'].queryset = item.part.get_conversion_options()
|
||||||
|
|
||||||
return form
|
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):
|
class StockLocationCreate(AjaxCreateView):
|
||||||
|
Loading…
Reference in New Issue
Block a user