2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-18 10:46:31 +00:00

Handle case where owner is null (#9732) (#9733)

(cherry picked from commit 89f8f132e1)

Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
github-actions[bot]
2025-06-03 16:05:09 +10:00
committed by GitHub
parent be04d0c4fc
commit 9e08b58f89

View File

@@ -819,7 +819,11 @@ class Owner(models.Model):
if self.owner_type.name == 'user' and get_global_setting(
'DISPLAY_FULL_NAMES', cache=True
):
return self.owner.get_full_name() or str(self.owner)
if self.owner and hasattr(self.owner, 'get_full_name'):
# Use the get_full_name method if available
return self.owner.get_full_name() or str(self.owner)
else:
return str(self.owner)
return str(self.owner)
def label(self):