2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-15 03:25:42 +00:00

List purchase orders for a given part

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

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,