mirror of
https://github.com/inventree/InvenTree.git
synced 2025-12-16 01:08:12 +00:00
Beginning to move the stocktake forms server side
This commit is contained in:
@@ -45,13 +45,34 @@ class CreateStockItemForm(HelperForm):
|
||||
class MoveStockItemForm(forms.ModelForm):
|
||||
""" Form for moving a StockItem to a new location """
|
||||
|
||||
def get_location_choices(self):
|
||||
locs = StockLocation.objects.all()
|
||||
|
||||
choices = [(None, '---------')]
|
||||
|
||||
for loc in locs:
|
||||
choices.append((loc.pk, loc.pathstring + ' - ' + loc.description))
|
||||
|
||||
return choices
|
||||
|
||||
location = forms.ChoiceField(label='Destination', required=True, help_text='Destination stock location')
|
||||
note = forms.CharField(label='Notes', required=True, help_text='Add note (required)')
|
||||
transaction = forms.BooleanField(required=False, initial=False, label='Create Transaction', help_text='Create a stock transaction for these parts')
|
||||
confirm = forms.BooleanField(required=False, initial=False, label='Confirm Stock Movement', help_text='Confirm movement of stock items')
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(MoveStockItemForm, self).__init__(*args, **kwargs)
|
||||
|
||||
self.fields['location'].choices = self.get_location_choices()
|
||||
|
||||
class Meta:
|
||||
model = StockItem
|
||||
|
||||
fields = [
|
||||
'location',
|
||||
'note',
|
||||
'transaction',
|
||||
'confirm',
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user