2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-29 20:16:44 +00:00

PEP fixes

This commit is contained in:
Oliver Walters 2019-06-10 23:08:08 +10:00
parent 3954b33fb7
commit d8d41c6eff
3 changed files with 9 additions and 9 deletions

View File

@ -43,7 +43,7 @@ class OrderStatus(StatusCode):
CANCELLED, CANCELLED,
LOST, LOST,
RETURNED RETURNED
] ]
class StockStatus(StatusCode): class StockStatus(StatusCode):

View File

@ -140,7 +140,7 @@ class Company(models.Model):
- Complete - Complete
- Failed / lost - Failed / lost
- Returned - Returned
""" """
return self.purchase_orders.exclude(status__in=OrderStatus.OPEN) return self.purchase_orders.exclude(status__in=OrderStatus.OPEN)
@ -153,6 +153,7 @@ class Company(models.Model):
return self.purchase_orders.filter(status__in=OrderStatus.FAILED) return self.purchase_orders.filter(status__in=OrderStatus.FAILED)
class Contact(models.Model): class Contact(models.Model):
""" A Contact represents a person who works at a particular company. """ A Contact represents a person who works at a particular company.
A Company may have zero or more associated Contact objects. A Company may have zero or more associated Contact objects.
@ -248,7 +249,7 @@ class SupplierPart(models.Model):
@property @property
def manufacturer_string(self): def manufacturer_string(self):
""" Format a MPN string for this SupplierPart. """ Format a MPN string for this SupplierPart.
Concatenates manufacture name and part number Concatenates manufacture name and part number.
""" """
items = [] items = []
@ -314,14 +315,14 @@ class SupplierPart(models.Model):
return None return None
def open_orders(self): def open_orders(self):
""" Return a database query for PO line items for this SupplierPart, """ Return a database query for PO line items for this SupplierPart,
limited to purchase orders that are open / outstanding. limited to purchase orders that are open / outstanding.
""" """
return self.purchase_order_line_items.prefetch_related('order').filter(order__status__in=OrderStatus.OPEN) return self.purchase_order_line_items.prefetch_related('order').filter(order__status__in=OrderStatus.OPEN)
def on_order(self): def on_order(self):
""" Return the total quantity of items currently on order. """ Return the total quantity of items currently on order.
Subtract partially received stock as appropriate Subtract partially received stock as appropriate
""" """
@ -332,13 +333,12 @@ class SupplierPart(models.Model):
q = totals.get('quantity__sum', 0) q = totals.get('quantity__sum', 0)
# Quantity received # Quantity received
r = totals.get('received__sum', 0) r = totals.get('received__sum', 0)
if q is None or r is None: if q is None or r is None:
return 0 return 0
else: else:
return max(q-r, 0) return max(q - r, 0)
def purchase_orders(self): def purchase_orders(self):
""" Returns a list of purchase orders relating to this supplier part """ """ Returns a list of purchase orders relating to this supplier part """

View File

@ -79,7 +79,7 @@ class PurchaseOrderCreate(AjaxCreateView):
except Company.DoesNotExist: except Company.DoesNotExist:
pass pass
return initials return initials
class PurchaseOrderEdit(AjaxUpdateView): class PurchaseOrderEdit(AjaxUpdateView):