Commit 30660c13 authored by Romain Courteaud's avatar Romain Courteaud

Support int index.

Surcharge getIntIndex in order to have a default sorting.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12550 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 76c0e48d
......@@ -60,6 +60,7 @@ class CalendarPeriod(Movement, Periodicity):
, PropertySheet.Arrow
, PropertySheet.Periodicity
, PropertySheet.Path
, PropertySheet.SortIndex
)
security.declareProtected(Permissions.AccessContentsInformation,
......@@ -197,3 +198,18 @@ class CalendarPeriod(Movement, Periodicity):
else:
next_start_date += 1
return next_start_date
security.declareProtected(Permissions.AccessContentsInformation,
'getIntIndex')
def getIntIndex(self, default=None, *args, **kw):
"""
Return a default value of the int index, based on the ID
"""
# XXX This method may be defined on a higher level document
result = self._baseGetIntIndex(*args, **kw)
if result in [None, '']:
try:
result = int(self.getId())
except ValueError:
result = default
return result
......@@ -57,6 +57,7 @@ class LeavePeriod(CalendarPeriod):
, PropertySheet.Arrow
, PropertySheet.Periodicity
, PropertySheet.Path
, PropertySheet.SortIndex
)
security.declareProtected(Permissions.AccessContentsInformation,
......
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