Add a separate form for creating a sales order allocation

This commit is contained in:
Oliver Walters 2021-03-29 16:43:26 +11:00
parent 88c1bc79d7
commit cffe2ba84b
2 changed files with 30 additions and 1 deletions

View File

@ -211,7 +211,36 @@ class EditSalesOrderLineItemForm(HelperForm):
]
class CreateSalesOrderAllocationForm(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
"""
quantity = RoundingDecimalFormField(max_digits = 10, decimal_places=5)
serials = forms.CharField(
label=_("Serial Numbers"),
required=False,
help_text=_('Enter stock serial numbers'),
)
class Meta:
model = SalesOrderAllocation
fields = [
'line',
'item',
'quantity',
]
class EditSalesOrderAllocationForm(HelperForm):
"""
Form for editing a SalesOrderAllocation item
"""
quantity = RoundingDecimalFormField(max_digits=10, decimal_places=5)

View File

@ -1295,7 +1295,7 @@ class SalesOrderAllocationCreate(AjaxCreateView):
""" View for creating a new SalesOrderAllocation """
model = SalesOrderAllocation
form_class = order_forms.EditSalesOrderAllocationForm
form_class = order_forms.CreateSalesOrderAllocationForm
ajax_form_title = _('Allocate Stock to Order')
def get_initial(self):