mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-01 11:10:54 +00:00
PEP fixes
This commit is contained in:
@ -9,9 +9,6 @@ from django import forms
|
||||
from django.forms.utils import ErrorDict
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from crispy_forms.layout import Field, Layout
|
||||
from crispy_forms.bootstrap import PrependedText
|
||||
|
||||
from mptt.fields import TreeNodeChoiceField
|
||||
|
||||
from InvenTree.helpers import GetExportFormats
|
||||
@ -111,23 +108,7 @@ class SerializeStockForm(HelperForm):
|
||||
item = kwargs.pop('item', None)
|
||||
|
||||
if item:
|
||||
|
||||
# Pre-calculate what the serial numbers should be!
|
||||
sn = item.part.getNextSerialNumber()
|
||||
|
||||
if item.quantity >= 2:
|
||||
sn = "{n}-{m}".format(n=sn, m=int(sn+item.quantity-1))
|
||||
else:
|
||||
sn = str(sn)
|
||||
|
||||
|
||||
self.field_placeholder = {
|
||||
'serial_numbers': sn
|
||||
}
|
||||
|
||||
self.field_prefix = {
|
||||
'serial_numbers': 'fa-hashtag',
|
||||
}
|
||||
self.field_placeholder['serial_numbers'] = item.part.getSerialNumberString(item.quantity)
|
||||
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
|
@ -308,7 +308,6 @@ class StockTest(TestCase):
|
||||
item.delete_on_deplete = True
|
||||
item.save()
|
||||
|
||||
|
||||
n = StockItem.objects.filter(part=25).count()
|
||||
|
||||
self.assertEqual(item.quantity, 10)
|
||||
|
@ -755,7 +755,7 @@ class StockItemSerialize(AjaxUpdateView):
|
||||
model = StockItem
|
||||
ajax_template_name = 'stock/item_serialize.html'
|
||||
ajax_form_title = _('Serialize Stock')
|
||||
#form_class = SerializeStockForm
|
||||
form_class = SerializeStockForm
|
||||
|
||||
def get_form(self):
|
||||
|
||||
@ -774,16 +774,8 @@ class StockItemSerialize(AjaxUpdateView):
|
||||
|
||||
item = self.get_object()
|
||||
|
||||
# Pre-calculate what the serial numbers should be!
|
||||
sn = item.part.getNextSerialNumber()
|
||||
|
||||
if item.quantity >= 2:
|
||||
sn = "{n}-{m}".format(n=sn, m=int(sn+item.quantity-1))
|
||||
else:
|
||||
sn = str(sn)
|
||||
|
||||
initials['quantity'] = item.quantity
|
||||
initials['serial_numbers'] = sn
|
||||
initials['serial_numbers'] = item.part.getSerialNumberString(item.quantity)
|
||||
initials['destination'] = item.location.pk
|
||||
|
||||
return initials
|
||||
|
Reference in New Issue
Block a user