mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
905d78e25c
- Marks build as complete - Deletes temporary BuildItem objects - Preselects the part's default_location if there is one - Creates a new stockitem in the selected location
58 lines
1.2 KiB
Python
58 lines
1.2 KiB
Python
"""
|
|
Django Forms for interacting with Build objects
|
|
"""
|
|
|
|
# -*- coding: utf-8 -*-
|
|
from __future__ import unicode_literals
|
|
|
|
from InvenTree.forms import HelperForm
|
|
from django import forms
|
|
from .models import Build, BuildItem
|
|
from stock.models import StockLocation
|
|
|
|
|
|
class EditBuildForm(HelperForm):
|
|
""" Form for editing a Build object.
|
|
"""
|
|
|
|
class Meta:
|
|
model = Build
|
|
fields = [
|
|
'title',
|
|
'part',
|
|
'quantity',
|
|
'batch',
|
|
'URL',
|
|
'notes',
|
|
]
|
|
|
|
|
|
class CompleteBuildForm(HelperForm):
|
|
""" Form for marking a Build as complete """
|
|
|
|
location = forms.ModelChoiceField(
|
|
queryset=StockLocation.objects.all(),
|
|
help_text='Location of completed parts',
|
|
)
|
|
|
|
confirm = forms.BooleanField(required=False, help_text='Confirm build submission')
|
|
|
|
class Meta:
|
|
model = Build
|
|
fields = [
|
|
'location',
|
|
'confirm'
|
|
]
|
|
|
|
|
|
class EditBuildItemForm(HelperForm):
|
|
""" Form for adding a new BuildItem to a Build """
|
|
|
|
class Meta:
|
|
model = BuildItem
|
|
fields = [
|
|
'build',
|
|
'stock_item',
|
|
'quantity',
|
|
]
|