InvenTree/InvenTree/stock/forms.py

87 lines
1.8 KiB
Python
Raw Normal View History

2019-04-27 12:49:16 +00:00
"""
Django Forms for interacting with Stock app
"""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import forms
2018-04-29 14:59:36 +00:00
from InvenTree.forms import HelperForm
from .models import StockLocation, StockItem
2018-04-17 13:56:25 +00:00
2018-04-29 14:59:36 +00:00
class EditStockLocationForm(HelperForm):
2019-04-27 12:49:16 +00:00
""" Form for editing a StockLocation """
class Meta:
model = StockLocation
fields = [
'name',
'parent',
'description'
]
2018-04-29 14:59:36 +00:00
class CreateStockItemForm(HelperForm):
2019-04-27 12:49:16 +00:00
""" Form for creating a new StockItem """
class Meta:
model = StockItem
fields = [
'part',
'supplier_part',
'location',
'batch',
'quantity',
'delete_on_deplete',
'status',
'notes',
2018-04-16 11:07:57 +00:00
'URL',
2018-04-15 15:02:17 +00:00
]
2018-04-29 14:59:36 +00:00
class MoveStockItemForm(forms.ModelForm):
2019-04-27 12:49:16 +00:00
""" Form for moving a StockItem to a new location """
2018-04-29 14:59:36 +00:00
2019-04-12 14:52:26 +00:00
note = forms.CharField(label='Notes', required=True, help_text='Add note (required)')
2018-04-29 14:59:36 +00:00
class Meta:
model = StockItem
fields = [
'location',
]
2018-04-30 11:03:25 +00:00
class StocktakeForm(forms.ModelForm):
class Meta:
model = StockItem
fields = [
'quantity',
]
2018-04-29 14:59:36 +00:00
class EditStockItemForm(HelperForm):
2019-05-09 08:38:37 +00:00
""" Form for editing a StockItem object.
Note that not all fields can be edited here (even if they can be specified during creation.
location - Must be updated in a 'move' transaction
quantity - Must be updated in a 'stocktake' transaction
part - Cannot be edited after creation
"""
2018-04-29 14:59:36 +00:00
class Meta:
model = StockItem
fields = [
'supplier_part',
2018-04-29 14:59:36 +00:00
'batch',
'delete_on_deplete',
2018-04-29 14:59:36 +00:00
'status',
'notes',
'URL',
2019-04-13 23:23:24 +00:00
]