mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 19:46:46 +00:00
Provide initial data
This commit is contained in:
parent
7575a39b7f
commit
6c5b09efd4
@ -462,13 +462,25 @@ class StockLocationCreate(AjaxCreateView):
|
|||||||
return initials
|
return initials
|
||||||
|
|
||||||
|
|
||||||
class StockItemSerialize(AjaxView, FormMixin):
|
class StockItemSerialize(AjaxUpdateView):
|
||||||
""" View for manually serializing a StockItem """
|
""" View for manually serializing a StockItem """
|
||||||
|
|
||||||
|
model = StockItem
|
||||||
ajax_template_name = 'stock/item_serialize.html'
|
ajax_template_name = 'stock/item_serialize.html'
|
||||||
ajax_form_title = 'Serialize Stock'
|
ajax_form_title = 'Serialize Stock'
|
||||||
form_class = SerializeStockForm
|
form_class = SerializeStockForm
|
||||||
|
|
||||||
|
def get_initial(self):
|
||||||
|
|
||||||
|
initials = super().get_initial().copy()
|
||||||
|
|
||||||
|
item = self.get_object()
|
||||||
|
|
||||||
|
initials['quantity'] = item.quantity
|
||||||
|
initials['destination'] = item.location.pk
|
||||||
|
|
||||||
|
return initials
|
||||||
|
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
|
|
||||||
return super().get(request, *args, **kwargs)
|
return super().get(request, *args, **kwargs)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user