mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
PEP fixes
This commit is contained in:
parent
75b21bdd8f
commit
6603d6e9ed
@ -285,7 +285,6 @@ class StockList(generics.ListCreateAPIView):
|
||||
# Does the client wish to filter by stock location?
|
||||
loc_id = self.request.query_params.get('location', None)
|
||||
|
||||
|
||||
if loc_id:
|
||||
try:
|
||||
location = StockLocation.objects.get(pk=loc_id)
|
||||
|
@ -122,7 +122,6 @@ class StockItem(models.Model):
|
||||
# ensure that the serial number is unique
|
||||
# across all variants of the same template part
|
||||
|
||||
|
||||
try:
|
||||
if self.serial is not None and self.part.variant_of is not None:
|
||||
if StockItem.objects.filter(part__variant_of=self.part.variant_of, serial=self.serial).exclude(id=self.id).exists():
|
||||
@ -211,11 +210,11 @@ class StockItem(models.Model):
|
||||
)
|
||||
|
||||
part = models.ForeignKey('part.Part', on_delete=models.CASCADE,
|
||||
related_name='stock_items', help_text='Base part',
|
||||
limit_choices_to={
|
||||
'is_template': False,
|
||||
'active': True,
|
||||
})
|
||||
related_name='stock_items', help_text='Base part',
|
||||
limit_choices_to={
|
||||
'is_template': False,
|
||||
'active': True,
|
||||
})
|
||||
|
||||
supplier_part = models.ForeignKey('company.SupplierPart', blank=True, null=True, on_delete=models.SET_NULL,
|
||||
help_text='Select a matching supplier part for this stock item')
|
||||
|
@ -208,9 +208,9 @@ class StockItemCreate(AjaxCreateView):
|
||||
|
||||
try:
|
||||
part = Part.objects.get(id=part_id)
|
||||
|
||||
# Hide the 'part' field (as a valid part is selected)
|
||||
form.fields['part'].widget = HiddenInput()
|
||||
|
||||
|
||||
# If the part is NOT purchaseable, hide the supplier_part field
|
||||
if not part.purchaseable:
|
||||
|
Loading…
Reference in New Issue
Block a user