2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-12-16 01:08:12 +00:00

Form / view for downloading stocktake info

This commit is contained in:
Oliver Walters
2019-09-08 22:37:27 +10:00
parent f4e71d6055
commit faf8b9f2f0
4 changed files with 84 additions and 0 deletions

View File

@@ -96,6 +96,37 @@ class SerializeStockForm(forms.ModelForm):
]
class ExportOptionsForm(HelperForm):
""" Form for selecting stock export options """
file_format = forms.ChoiceField(label=_('File Format'), help_text=_('Select output file format'))
include_sublocations = forms.BooleanField(required=False, initial=True, help_text=_("Include stock items in sub locations"))
class Meta:
model = StockLocation
fields = [
'file_format',
'include_sublocations',
]
def get_format_choices(self):
""" File format choices """
choices = [
('csv', 'CSV'),
('xls', 'XLS'),
('xlsx', 'XLSX'),
]
return choices
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['file_format'].choices = self.get_format_choices()
class AdjustStockForm(forms.ModelForm):
""" Form for performing simple stock adjustments.