mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +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?
|
# Does the client wish to filter by stock location?
|
||||||
loc_id = self.request.query_params.get('location', None)
|
loc_id = self.request.query_params.get('location', None)
|
||||||
|
|
||||||
|
|
||||||
if loc_id:
|
if loc_id:
|
||||||
try:
|
try:
|
||||||
location = StockLocation.objects.get(pk=loc_id)
|
location = StockLocation.objects.get(pk=loc_id)
|
||||||
|
@ -122,7 +122,6 @@ class StockItem(models.Model):
|
|||||||
# ensure that the serial number is unique
|
# ensure that the serial number is unique
|
||||||
# across all variants of the same template part
|
# across all variants of the same template part
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if self.serial is not None and self.part.variant_of is not None:
|
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():
|
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,
|
part = models.ForeignKey('part.Part', on_delete=models.CASCADE,
|
||||||
related_name='stock_items', help_text='Base part',
|
related_name='stock_items', help_text='Base part',
|
||||||
limit_choices_to={
|
limit_choices_to={
|
||||||
'is_template': False,
|
'is_template': False,
|
||||||
'active': True,
|
'active': True,
|
||||||
})
|
})
|
||||||
|
|
||||||
supplier_part = models.ForeignKey('company.SupplierPart', blank=True, null=True, on_delete=models.SET_NULL,
|
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')
|
help_text='Select a matching supplier part for this stock item')
|
||||||
|
@ -208,9 +208,9 @@ class StockItemCreate(AjaxCreateView):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
part = Part.objects.get(id=part_id)
|
part = Part.objects.get(id=part_id)
|
||||||
|
|
||||||
# Hide the 'part' field (as a valid part is selected)
|
# Hide the 'part' field (as a valid part is selected)
|
||||||
form.fields['part'].widget = HiddenInput()
|
form.fields['part'].widget = HiddenInput()
|
||||||
|
|
||||||
|
|
||||||
# If the part is NOT purchaseable, hide the supplier_part field
|
# If the part is NOT purchaseable, hide the supplier_part field
|
||||||
if not part.purchaseable:
|
if not part.purchaseable:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user