Skip to content

Commit e7dd495

Browse files
Handle case where owner is null (#9732)
(cherry picked from commit 89f8f13)
1 parent be04d0c commit e7dd495

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/backend/InvenTree/users/models.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,11 @@ def name(self):
819819
if self.owner_type.name == 'user' and get_global_setting(
820820
'DISPLAY_FULL_NAMES', cache=True
821821
):
822-
return self.owner.get_full_name() or str(self.owner)
822+
if self.owner and hasattr(self.owner, 'get_full_name'):
823+
# Use the get_full_name method if available
824+
return self.owner.get_full_name() or str(self.owner)
825+
else:
826+
return str(self.owner)
823827
return str(self.owner)
824828

825829
def label(self):

0 commit comments

Comments
 (0)