mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Do not enforce serialization when creating a stock item
This commit is contained in:
parent
614363fa03
commit
88b90281f5
@ -7,6 +7,7 @@ from __future__ import unicode_literals
|
||||
|
||||
from django import forms
|
||||
from django.forms.utils import ErrorDict
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from InvenTree.forms import HelperForm
|
||||
from .models import StockLocation, StockItem, StockItemTracking
|
||||
@ -27,7 +28,7 @@ class EditStockLocationForm(HelperForm):
|
||||
class CreateStockItemForm(HelperForm):
|
||||
""" Form for creating a new StockItem """
|
||||
|
||||
serial_numbers = forms.CharField(label='Serial numbers', required=False, help_text='Enter unique serial numbers')
|
||||
serial_numbers = forms.CharField(label='Serial numbers', required=False, help_text=_('Enter unique serial numbers (or leave blank)'))
|
||||
|
||||
class Meta:
|
||||
model = StockItem
|
||||
|
@ -593,6 +593,10 @@ class StockItemCreate(AjaxCreateView):
|
||||
if part.trackable:
|
||||
sn = request.POST.get('serial_numbers', '')
|
||||
|
||||
sn = str(sn).strip()
|
||||
|
||||
# If user has specified a range of serial numbers
|
||||
if len(sn) > 0:
|
||||
try:
|
||||
serials = ExtractSerialNumbers(sn, quantity)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user