Commit c14e0cff authored by Vincent Pelletier's avatar Vincent Pelletier

Workflow_statusModify: Add support for delayed workflow transition.

Delayed workflow transition works with 3 states:
- initial state: where we are
- final state: where we want to go
- waiting state: where we wait for the right time to transition to final state
The main advantages of the waiting state are:
- prevents multiple transitions from being scheduled
- allows customising object security (ex: preventing unwanted edits)
- allows storing intended execution date in a transition comment
parent c3ba9069
......@@ -46,8 +46,24 @@ if listbox is not None:
listbox_line_list.append(value)
doaction_param_list['listbox'] = tuple(listbox_line_list)
execution_date = doaction_param_list.pop('execution_date', None)
if execution_date is not None:
context.activate(
activity='SQLQueue',
at_date=execution_date,
).Base_workflowStatusModify(
workflow_action=doaction_param_list.pop('next_workflow_action'),
comment=doaction_param_list.get('comment', ''),
batch=True,
)
doaction_param_list['comment'] = translateString(
'Scheduled for execution at $time',
mapping={
'time': str(execution_date),
},
)
try:
context.portal_workflow.doActionFor(
portal.portal_workflow.doActionFor(
context,
doaction_param_list['workflow_action'],
**doaction_param_list)
......
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