2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 21:15:41 +00:00

Adds form to assign stock item by serial numbers

This commit is contained in:
Oliver Walters
2021-03-29 23:10:36 +11:00
parent cffe2ba84b
commit bd87f4c733
5 changed files with 133 additions and 11 deletions

View File

@ -14,6 +14,8 @@ from InvenTree.forms import HelperForm
from InvenTree.fields import RoundingDecimalFormField
from InvenTree.fields import DatePickerFormField
import part.models
from stock.models import StockLocation
from .models import PurchaseOrder, PurchaseOrderLineItem, PurchaseOrderAttachment
from .models import SalesOrder, SalesOrderLineItem, SalesOrderAttachment
@ -211,22 +213,43 @@ class EditSalesOrderLineItemForm(HelperForm):
]
class CreateSalesOrderAllocationForm(HelperForm):
class AllocateSerialsToSalesOrderForm(HelperForm):
"""
Form for creating a SalesOrderAllocation item.
This can be allocated by selecting a specific stock item,
or by providing a sequence of serial numbers
Form for assigning stock to a sales order,
by serial number lookup
"""
quantity = RoundingDecimalFormField(max_digits = 10, decimal_places=5)
line = forms.ModelChoiceField(
queryset = SalesOrderLineItem.objects.all(),
)
part = forms.ModelChoiceField(
queryset = part.models.Part.objects.all(),
)
serials = forms.CharField(
label=_("Serial Numbers"),
required=False,
help_text=_('Enter stock serial numbers'),
help_text=_('Enter stock item serial numbers'),
)
class Meta:
model = SalesOrderAllocation
fields = [
'line',
'part',
'serials',
]
class CreateSalesOrderAllocationForm(HelperForm):
"""
Form for creating a SalesOrderAllocation item.
"""
quantity = RoundingDecimalFormField(max_digits = 10, decimal_places=5)
class Meta:
model = SalesOrderAllocation