mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-15 03:25:42 +00:00
removes all lines consisting only of spaces
this really bothers me for some reason - nothing technical
This commit is contained in:
@ -349,7 +349,7 @@ class Part(MPTTModel):
|
||||
|
||||
context['available'] = self.available_stock
|
||||
context['on_order'] = self.on_order
|
||||
|
||||
|
||||
context['required'] = context['required_build_order_quantity'] + context['required_sales_order_quantity']
|
||||
context['allocated'] = context['allocated_build_order_quantity'] + context['allocated_sales_order_quantity']
|
||||
|
||||
@ -434,7 +434,7 @@ class Part(MPTTModel):
|
||||
a) The parent part is the same as this one
|
||||
b) The parent part is used in the BOM for *this* part
|
||||
c) The parent part is used in the BOM for any child parts under this one
|
||||
|
||||
|
||||
Failing this check raises a ValidationError!
|
||||
|
||||
"""
|
||||
@ -506,7 +506,7 @@ class Part(MPTTModel):
|
||||
|
||||
parts = Part.objects.filter(tree_id=self.tree_id)
|
||||
stock = StockModels.StockItem.objects.filter(part__in=parts).exclude(serial=None)
|
||||
|
||||
|
||||
# There are no matchin StockItem objects (skip further tests)
|
||||
if not stock.exists():
|
||||
return None
|
||||
@ -578,7 +578,7 @@ class Part(MPTTModel):
|
||||
|
||||
if self.IPN:
|
||||
elements.append(self.IPN)
|
||||
|
||||
|
||||
elements.append(self.name)
|
||||
|
||||
if self.revision:
|
||||
@ -663,7 +663,7 @@ class Part(MPTTModel):
|
||||
def clean(self):
|
||||
"""
|
||||
Perform cleaning operations for the Part model
|
||||
|
||||
|
||||
Update trackable status:
|
||||
If this part is trackable, and it is used in the BOM
|
||||
for a parent part which is *not* trackable,
|
||||
@ -946,7 +946,7 @@ class Part(MPTTModel):
|
||||
quantity = 0
|
||||
|
||||
for build in builds:
|
||||
|
||||
|
||||
bom_item = None
|
||||
|
||||
# List the bom lines required to make the build (including inherited ones!)
|
||||
@ -958,7 +958,7 @@ class Part(MPTTModel):
|
||||
build_quantity = build.quantity * bom_item.quantity
|
||||
|
||||
quantity += build_quantity
|
||||
|
||||
|
||||
return quantity
|
||||
|
||||
def requiring_sales_orders(self):
|
||||
@ -1008,7 +1008,7 @@ class Part(MPTTModel):
|
||||
def quantity_to_order(self):
|
||||
"""
|
||||
Return the quantity needing to be ordered for this part.
|
||||
|
||||
|
||||
Here, an "order" could be one of:
|
||||
- Build Order
|
||||
- Sales Order
|
||||
@ -1019,7 +1019,7 @@ class Part(MPTTModel):
|
||||
Required for orders = self.required_order_quantity()
|
||||
Currently on order = self.on_order
|
||||
Currently building = self.quantity_being_built
|
||||
|
||||
|
||||
"""
|
||||
|
||||
# Total requirement
|
||||
@ -1114,7 +1114,7 @@ class Part(MPTTModel):
|
||||
|
||||
if total is None:
|
||||
total = 0
|
||||
|
||||
|
||||
return max(total, 0)
|
||||
|
||||
@property
|
||||
@ -1238,7 +1238,7 @@ class Part(MPTTModel):
|
||||
@property
|
||||
def total_stock(self):
|
||||
""" Return the total stock quantity for this part.
|
||||
|
||||
|
||||
- Part may be stored in multiple locations
|
||||
- If this part is a "template" (variants exist) then these are counted too
|
||||
"""
|
||||
@ -1463,7 +1463,7 @@ class Part(MPTTModel):
|
||||
|
||||
# Start with a list of all parts designated as 'sub components'
|
||||
parts = Part.objects.filter(component=True)
|
||||
|
||||
|
||||
# Exclude this part
|
||||
parts = parts.exclude(id=self.id)
|
||||
|
||||
@ -1496,7 +1496,7 @@ class Part(MPTTModel):
|
||||
|
||||
def get_price_info(self, quantity=1, buy=True, bom=True):
|
||||
""" Return a simplified pricing string for this part
|
||||
|
||||
|
||||
Args:
|
||||
quantity: Number of units to calculate price for
|
||||
buy: Include supplier pricing (default = True)
|
||||
@ -1519,7 +1519,7 @@ class Part(MPTTModel):
|
||||
return "{a} - {b}".format(a=min_price, b=max_price)
|
||||
|
||||
def get_supplier_price_range(self, quantity=1):
|
||||
|
||||
|
||||
min_price = None
|
||||
max_price = None
|
||||
|
||||
@ -1586,7 +1586,7 @@ class Part(MPTTModel):
|
||||
return (min_price, max_price)
|
||||
|
||||
def get_price_range(self, quantity=1, buy=True, bom=True):
|
||||
|
||||
|
||||
""" Return the price range for this part. This price can be either:
|
||||
|
||||
- Supplier price (if purchased from suppliers)
|
||||
@ -1645,7 +1645,7 @@ class Part(MPTTModel):
|
||||
|
||||
@transaction.atomic
|
||||
def copy_parameters_from(self, other, **kwargs):
|
||||
|
||||
|
||||
clear = kwargs.get('clear', True)
|
||||
|
||||
if clear:
|
||||
@ -1692,7 +1692,7 @@ class Part(MPTTModel):
|
||||
# Copy the parameters data
|
||||
if kwargs.get('parameters', True):
|
||||
self.copy_parameters_from(other)
|
||||
|
||||
|
||||
# Copy the fields that aren't available in the duplicate form
|
||||
self.salable = other.salable
|
||||
self.assembly = other.assembly
|
||||
@ -1722,7 +1722,7 @@ class Part(MPTTModel):
|
||||
tests = tests.filter(required=required)
|
||||
|
||||
return tests
|
||||
|
||||
|
||||
def getRequiredTests(self):
|
||||
# Return the tests which are required by this part
|
||||
return self.getTestTemplates(required=True)
|
||||
@ -1868,7 +1868,7 @@ class PartAttachment(InvenTreeAttachment):
|
||||
"""
|
||||
Model for storing file attachments against a Part object
|
||||
"""
|
||||
|
||||
|
||||
def getSubdir(self):
|
||||
return os.path.join("part_files", str(self.part.id))
|
||||
|
||||
@ -2227,7 +2227,7 @@ class BomItem(models.Model):
|
||||
|
||||
def validate_hash(self, valid=True):
|
||||
""" Mark this item as 'valid' (store the checksum hash).
|
||||
|
||||
|
||||
Args:
|
||||
valid: If true, validate the hash, otherwise invalidate it (default = True)
|
||||
"""
|
||||
@ -2265,7 +2265,7 @@ class BomItem(models.Model):
|
||||
# Check for circular BOM references
|
||||
if self.sub_part:
|
||||
self.sub_part.checkAddToBOM(self.part)
|
||||
|
||||
|
||||
# If the sub_part is 'trackable' then the 'quantity' field must be an integer
|
||||
if self.sub_part.trackable:
|
||||
if not self.quantity == int(self.quantity):
|
||||
@ -2301,7 +2301,7 @@ class BomItem(models.Model):
|
||||
"""
|
||||
|
||||
query = self.sub_part.stock_items.all()
|
||||
|
||||
|
||||
query = query.prefetch_related([
|
||||
'sub_part__stock_items',
|
||||
])
|
||||
@ -2358,7 +2358,7 @@ class BomItem(models.Model):
|
||||
def get_required_quantity(self, build_quantity):
|
||||
""" Calculate the required part quantity, based on the supplier build_quantity.
|
||||
Includes overage estimate in the returned value.
|
||||
|
||||
|
||||
Args:
|
||||
build_quantity: Number of parts to build
|
||||
|
||||
|
Reference in New Issue
Block a user