From 388b722de1ea4228f0c8a541e2cc2d08f7e62af4 Mon Sep 17 00:00:00 2001 From: Oliver Date: Sat, 21 Oct 2023 21:35:51 +1100 Subject: [PATCH] Handle case where 'title' does not exist (#5767) --- InvenTree/stock/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index f6eb6b876e..428069004c 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -2206,7 +2206,7 @@ class StockItemTracking(models.Model): Note: 2021-05-11 The legacy StockTrackingItem model contained very little information about the "history" of the item. In fact, only the "quantity" of the item was recorded at each interaction. - Also, the "title" was translated at time of generation, and thus was not really translateable. + Also, the "title" was translated at time of generation, and thus was not really translatable. The "new" system tracks all 'delta' changes to the model, and tracks change "type" which can then later be translated @@ -2233,7 +2233,8 @@ class StockItemTracking(models.Model): """Return label.""" if self.tracking_type in StockHistoryCode.keys(): return StockHistoryCode.label(self.tracking_type) - return self.title + + return getattr(self, 'title', '') tracking_type = models.IntegerField( default=StockHistoryCode.LEGACY,