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

Use API forms for creating and editing BomItem objects

This commit is contained in:
Oliver Walters
2021-08-04 17:25:51 +10:00
parent 96a79e557b
commit 75a1be0284
5 changed files with 43 additions and 188 deletions

View File

@@ -18,7 +18,6 @@ import common.models
from common.forms import MatchItemForm
from .models import Part, PartCategory, PartRelated
from .models import BomItem
from .models import PartParameterTemplate, PartParameter
from .models import PartCategoryParameterTemplate
from .models import PartSellPriceBreak, PartInternalPriceBreak
@@ -317,33 +316,6 @@ class EditCategoryParameterTemplateForm(HelperForm):
]
class EditBomItemForm(HelperForm):
""" Form for editing a BomItem object """
quantity = RoundingDecimalFormField(max_digits=10, decimal_places=5, label=_('Quantity'))
sub_part = PartModelChoiceField(queryset=Part.objects.all(), label=_('Sub part'))
class Meta:
model = BomItem
fields = [
'part',
'sub_part',
'quantity',
'reference',
'overage',
'note',
'allow_variants',
'inherited',
'optional',
]
# Prevent editing of the part associated with this BomItem
widgets = {
'part': forms.HiddenInput()
}
class PartPriceForm(forms.Form):
""" Simple form for viewing part pricing information """