List purchase orders for a given part

This commit is contained in:
Oliver Walters committed 2019-06-05 21:47:22 +10:00
1 parent 9b2b2841d9
commit 67248ec4dd
11 files changed
+103 -20

No files matched your search

+5
View File
@@ -307,6 +307,11 @@ class SupplierPart(models.Model):
else:
return None
def purchase_orders(self):
""" Returns a list of purchase orders relating to this supplier part """
return [line.order for line in self.purchase_order_line_items.all().prefetch_related('order')]
def __str__(self):
s = "{supplier} ({sku})".format(
sku=self.SKU,