workflows: allow marking a status as terminal
This commit is contained in:
parent
ed8b18268f
commit
af78aecfac
|
@ -272,7 +272,8 @@ class WorkflowItemsDir(Directory):
|
||||||
|
|
||||||
class WorkflowStatusPage(Directory):
|
class WorkflowStatusPage(Directory):
|
||||||
_q_exports = ['', 'delete', 'newitem', ('items', 'items_dir'),
|
_q_exports = ['', 'delete', 'newitem', ('items', 'items_dir'),
|
||||||
'update_order', 'edit', 'reassign', 'visibility']
|
'update_order', 'edit', 'reassign', 'visibility',
|
||||||
|
'force_endpoint', 'unforce_endpoint']
|
||||||
|
|
||||||
def __init__(self, workflow, status_id):
|
def __init__(self, workflow, status_id):
|
||||||
self.workflow = workflow
|
self.workflow = workflow
|
||||||
|
@ -354,6 +355,10 @@ class WorkflowStatusPage(Directory):
|
||||||
'<ul>'
|
'<ul>'
|
||||||
'<li><a href="edit">%s</a></li>' % _('Change Status Name')
|
'<li><a href="edit">%s</a></li>' % _('Change Status Name')
|
||||||
'<li><a href="visibility" rel="popup">%s</a></li>' % _('Change Status Visibility')
|
'<li><a href="visibility" rel="popup">%s</a></li>' % _('Change Status Visibility')
|
||||||
|
if not self.status.forced_endpoint:
|
||||||
|
'<li><a href="force_endpoint">%s</a></li>' % _('Mark the Status as Terminal')
|
||||||
|
else:
|
||||||
|
'<li><a href="unforce_endpoint">%s</a></li>' % _('Unmark the Status as Terminal')
|
||||||
'<li><a href="delete" rel="popup">%s</a></li>' % _('Delete')
|
'<li><a href="delete" rel="popup">%s</a></li>' % _('Delete')
|
||||||
'</ul>'
|
'</ul>'
|
||||||
'<div id="new-field">'
|
'<div id="new-field">'
|
||||||
|
@ -553,6 +558,16 @@ class WorkflowStatusPage(Directory):
|
||||||
'<h2>%s</h2>' % _('Edit Workflow Status Visibility')
|
'<h2>%s</h2>' % _('Edit Workflow Status Visibility')
|
||||||
form.render()
|
form.render()
|
||||||
|
|
||||||
|
def force_endpoint(self):
|
||||||
|
self.status.forced_endpoint = True
|
||||||
|
self.workflow.store()
|
||||||
|
return redirect('.')
|
||||||
|
|
||||||
|
def unforce_endpoint(self):
|
||||||
|
self.status.forced_endpoint = False
|
||||||
|
self.workflow.store()
|
||||||
|
return redirect('.')
|
||||||
|
|
||||||
|
|
||||||
class WorkflowStatusDirectory(Directory):
|
class WorkflowStatusDirectory(Directory):
|
||||||
_q_exports = ['']
|
_q_exports = ['']
|
||||||
|
|
|
@ -133,9 +133,12 @@ class Workflow(StorableObject):
|
||||||
for status in self.possible_status:
|
for status in self.possible_status:
|
||||||
waitpoint = False
|
waitpoint = False
|
||||||
endpoint = True
|
endpoint = True
|
||||||
for item in status.items:
|
if status.forced_endpoint:
|
||||||
endpoint = item.endpoint and endpoint
|
endpoint = True
|
||||||
waitpoint = item.waitpoint or waitpoint
|
else:
|
||||||
|
for item in status.items:
|
||||||
|
endpoint = item.endpoint and endpoint
|
||||||
|
waitpoint = item.waitpoint or waitpoint
|
||||||
if endpoint or waitpoint:
|
if endpoint or waitpoint:
|
||||||
waitpoint_status.append(status)
|
waitpoint_status.append(status)
|
||||||
return waitpoint_status
|
return waitpoint_status
|
||||||
|
@ -148,6 +151,8 @@ class Workflow(StorableObject):
|
||||||
def get_not_endpoint_status(self):
|
def get_not_endpoint_status(self):
|
||||||
not_endpoint_status = []
|
not_endpoint_status = []
|
||||||
for status in self.possible_status:
|
for status in self.possible_status:
|
||||||
|
if status.forced_endpoint:
|
||||||
|
continue
|
||||||
endpoint = True
|
endpoint = True
|
||||||
for item in status.items:
|
for item in status.items:
|
||||||
endpoint = item.endpoint and endpoint
|
endpoint = item.endpoint and endpoint
|
||||||
|
@ -335,6 +340,7 @@ class WorkflowStatus:
|
||||||
name = None
|
name = None
|
||||||
items = None
|
items = None
|
||||||
visibility = None
|
visibility = None
|
||||||
|
forced_endpoint = False
|
||||||
|
|
||||||
def __init__(self, name = None):
|
def __init__(self, name = None):
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
Loading…
Reference in New Issue