Commit e41c43b8 authored by Jérome Perrin's avatar Jérome Perrin

ERP5Type.Base: prefer title over reference in getCompact*Title

parent cb33c6e9
...@@ -2349,8 +2349,8 @@ class Base( CopyContainer, ...@@ -2349,8 +2349,8 @@ class Base( CopyContainer,
Returns the first non-null value from the following: Returns the first non-null value from the following:
- "getCompactTitle" type based method - "getCompactTitle" type based method
- short title - short title
- reference
- title - title
- reference
- id - id
""" """
method = self._getTypeBasedMethod('getCompactTitle') method = self._getTypeBasedMethod('getCompactTitle')
...@@ -2360,8 +2360,8 @@ class Base( CopyContainer, ...@@ -2360,8 +2360,8 @@ class Base( CopyContainer,
if self.hasShortTitle(): if self.hasShortTitle():
r = self.getShortTitle() r = self.getShortTitle()
if r: return r if r: return r
return (self.getProperty('reference') or return (getattr(self, '_baseGetTitle', str)() or
getattr(self, '_baseGetTitle', str)() or self.getProperty('reference') or
self.getId()) self.getId())
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
...@@ -2373,9 +2373,9 @@ class Base( CopyContainer, ...@@ -2373,9 +2373,9 @@ class Base( CopyContainer,
- "getCompactTitle" type based method - "getCompactTitle" type based method
- translated short title - translated short title
- short title - short title
- reference
- translated title - translated title
- title - title
- reference
- id - id
""" """
method = self._getTypeBasedMethod('getCompactTranslatedTitle') method = self._getTypeBasedMethod('getCompactTranslatedTitle')
...@@ -2391,10 +2391,10 @@ class Base( CopyContainer, ...@@ -2391,10 +2391,10 @@ class Base( CopyContainer,
if r: return r if r: return r
r = self.getShortTitle() r = self.getShortTitle()
if r: return r if r: return r
return (self.getProperty('reference') or return (# No need to test existence since all Base instances have this method
# No need to test existence since all Base instances have this method
# Also useful whenever title is calculated # Also useful whenever title is calculated
self._baseGetTranslatedTitle() or self._baseGetTranslatedTitle() or
self.getProperty('reference') or
self.getId()) self.getId())
# This method allows to sort objects in list is a more reasonable way # This method allows to sort objects in list is a more reasonable way
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment