Commit 88a59696 authored by Rafael Monnerat's avatar Rafael Monnerat

erp5_credential: Allow create assignments with infinite duration

  If preferences sets a negative duration, don't set stop/start dates on
assignments.
parent cd24fb39
...@@ -21,7 +21,13 @@ open_assignment_list = context.CredentialRequest_closePersonAssignment(old_role_ ...@@ -21,7 +21,13 @@ open_assignment_list = context.CredentialRequest_closePersonAssignment(old_role_
#Initialisation #Initialisation
assignment_duration = context.portal_preferences.getPreferredCredentialAssignmentDuration() assignment_duration = context.portal_preferences.getPreferredCredentialAssignmentDuration()
today = DateTime() today = DateTime()
delay = today+assignment_duration if assignment_duration <= 0:
delay = None
start_date = None
else:
delay = today+assignment_duration
start_date = today - 1
current_assignment_list = {} current_assignment_list = {}
for assignment in open_assignment_list: for assignment in open_assignment_list:
...@@ -54,7 +60,7 @@ for role in context.getRoleList(): ...@@ -54,7 +60,7 @@ for role in context.getRoleList():
function = context.getFunctionList(), function = context.getFunctionList(),
group = context.getGroupList(), group = context.getGroupList(),
destination = organisation_url, destination = organisation_url,
start_date = today - 1, start_date = start_date,
stop_date = delay) stop_date = delay)
assignment.open() assignment.open()
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