Commit e95d053d authored by Romain Courteaud's avatar Romain Courteaud

Add getStartDate.

Calculate a new date, depending on the delay.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3439 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b25d7069
...@@ -136,3 +136,16 @@ class SupplyLink(Path, XMLObject): ...@@ -136,3 +136,16 @@ class SupplyLink(Path, XMLObject):
if len(previous_ind_phase_list) == 0: if len(previous_ind_phase_list) == 0:
result = 1 result = 1
return result return result
security.declareProtected(Permissions.View, 'getStartDate')
def getStartDate(self, stop_date):
"""
Calculate the start date, depending on the delay.
"""
max_delay = self.getMaxDelay()
min_delay = self.getMinDelay()
for delay in [max_delay, min_delay, 0]:
if type(delay) in (type(1), type(1.0)):
start_date = stop_date - delay
break
return start_date
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