Printable string for PurchaseOrderLineItem

This commit is contained in:
Oliver Walters 2019-06-13 21:21:22 +10:00
parent 52b7051060
commit 771a008e84

View File

@ -177,6 +177,13 @@ class PurchaseOrderLineItem(OrderLineItem):
('order', 'part')
)
def __str__(self):
return "{n} x {part} from {supplier} (for {po})".format(
n=self.quantity,
part=self.part.SKU if self.part else 'unknown part',
supplier=self.order.supplier.name,
po=self.order)
order = models.ForeignKey(
PurchaseOrder, on_delete=models.CASCADE,
related_name='lines',