mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Allow unserialized build
This commit is contained in:
parent
937bcd41d6
commit
86b2b9cdb1
@ -5,6 +5,8 @@ Django Forms for interacting with Build objects
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from InvenTree.forms import HelperForm
|
||||
from django import forms
|
||||
from .models import Build, BuildItem
|
||||
@ -31,7 +33,7 @@ class EditBuildForm(HelperForm):
|
||||
class ConfirmBuildForm(HelperForm):
|
||||
""" Form for auto-allocation of stock to a build """
|
||||
|
||||
confirm = forms.BooleanField(required=False, help_text='Confirm')
|
||||
confirm = forms.BooleanField(required=False, help_text=_('Confirm'))
|
||||
|
||||
class Meta:
|
||||
model = Build
|
||||
@ -48,9 +50,9 @@ class CompleteBuildForm(HelperForm):
|
||||
help_text='Location of completed parts',
|
||||
)
|
||||
|
||||
serial_numbers = forms.CharField(label='Serial numbers', help_text='Enter unique serial numbers')
|
||||
serial_numbers = forms.CharField(label='Serial numbers', required=False, help_text=_('Enter unique serial numbers (or leave blank)'))
|
||||
|
||||
confirm = forms.BooleanField(required=False, help_text='Confirm build submission')
|
||||
confirm = forms.BooleanField(required=False, help_text=_('Confirm build completion'))
|
||||
|
||||
class Meta:
|
||||
model = Build
|
||||
|
@ -270,6 +270,10 @@ class BuildComplete(AjaxUpdateView):
|
||||
|
||||
sn = request.POST.get('serial_numbers', '')
|
||||
|
||||
sn = str(sn).strip()
|
||||
|
||||
# If the user has specified serial numbers, check they are valid
|
||||
if len(sn) > 0:
|
||||
try:
|
||||
# Exctract a list of provided serial numbers
|
||||
serials = ExtractSerialNumbers(sn, build.quantity)
|
||||
|
Loading…
Reference in New Issue
Block a user