Handle case where 'title' does not exist (#5767)

This commit is contained in:
Oliver authored and GitHub committed 2023-10-21 21:35:51 +11:00
1 parent f0f4a20f4e
commit 388b722de1
1 file changed
+3 -2
+3 -2
View File
@@ -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,