fix __str__ instance

This commit is contained in:
Matthias 2022-05-02 22:46:03 +02:00
parent e7b189ba29
commit 87515b1b48
No known key found for this signature in database
GPG Key ID: AB6D0E6C4CB65093

View File

@ -228,7 +228,7 @@ class PurchaseOrder(Order):
prefix = getSetting('PURCHASEORDER_REFERENCE_PREFIX')
return f"{prefix}{self.reference} - {self.supplier.name}"
return f"{prefix}{self.reference} - {self.supplier.name if self.supplier else _('deleted')}"
reference = models.CharField(
unique=True,
@ -576,7 +576,7 @@ class SalesOrder(Order):
prefix = getSetting('SALESORDER_REFERENCE_PREFIX')
return f"{prefix}{self.reference} - {self.customer.name}"
return f"{prefix}{self.reference} - {self.customer.name if self.customer else _('deleted')}"
def get_absolute_url(self):
return reverse('so-detail', kwargs={'pk': self.id})
@ -939,7 +939,7 @@ class PurchaseOrderLineItem(OrderLineItem):
return "{n} x {part} from {supplier} (for {po})".format(
n=decimal2string(self.quantity),
part=self.part.SKU if self.part else 'unknown part',
supplier=self.order.supplier.name,
supplier=self.order.supplier.name if self.order.supplier else _('deleted'),
po=self.order)
order = models.ForeignKey(