[Erp5-report] r12521 - /erp5/trunk/products/ERP5/Document/Person.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Feb 2 11:48:39 CET 2007
Author: romain
Date: Fri Feb 2 11:48:38 2007
New Revision: 12521
URL: http://svn.erp5.org?rev=12521&view=rev
Log:
Add time management method: getAvailableTime and getAvailableTimeSequence.
Modified:
erp5/trunk/products/ERP5/Document/Person.py
Modified: erp5/trunk/products/ERP5/Document/Person.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Person.py?rev=12521&r1=12520&r2=12521&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Person.py (original)
+++ erp5/trunk/products/ERP5/Document/Person.py Fri Feb 2 11:48:38 2007
@@ -191,3 +191,34 @@
self._setPassword(pw_encrypt(value))
self.reindexObject()
+ # Time management
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getAvailableTime')
+ def getAvailableTime(self, *args, **kw):
+ """
+ Calculate available time for a person
+ """
+ assignment_list = self.contentValues(portal_type='Assignment')
+ calendar_uid_list = []
+ for assignment in assignment_list:
+ calendar_uid_list.extend(assignment.getCalendarUidList())
+ kw['node'] = [self.getUid()] + calendar_uid_list
+
+ portal_simulation = getToolByName(self, 'portal_simulation')
+ return portal_simulation.getAvailableTime(*args, **kw)
+
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getAvailableTimeSequence')
+ def getAvailableTimeSequence(self, *args, **kw):
+ """
+ Calculate available time for a person in a sequence
+ """
+ assignment_list = self.contentValues(portal_type='Assignment')
+ calendar_uid_list = []
+ for assignment in assignment_list:
+ calendar_uid_list.extend(assignment.getCalendarUidList())
+ kw['node'] = [self.getUid()] + calendar_uid_list
+
+ # Call getSequence
+ portal_simulation = getToolByName(self, 'portal_simulation')
+ return portal_simulation.getAvailableTimeSequence(*args, **kw)
More information about the Erp5-report
mailing list