admin: detail target status on choice action (#39207)
This commit is contained in:
parent
b525483e36
commit
b49d4010f7
|
@ -15,7 +15,8 @@ from wcs.qommon.http_request import HTTPRequest
|
|||
from wcs.roles import Role
|
||||
from wcs.workflows import (
|
||||
Workflow, WorkflowCriticalityLevel, DisplayMessageWorkflowStatusItem,
|
||||
WorkflowBackofficeFieldsFormDef, CommentableWorkflowStatusItem)
|
||||
WorkflowBackofficeFieldsFormDef, CommentableWorkflowStatusItem,
|
||||
ChoiceWorkflowStatusItem)
|
||||
from wcs.wf.dispatch import DispatchWorkflowStatusItem
|
||||
from wcs.wf.export_to_model import ExportToModel
|
||||
from wcs.wf.jump import JumpWorkflowStatusItem
|
||||
|
@ -951,6 +952,63 @@ def test_workflows_edit_choice_action_functions_only(pub):
|
|||
assert '_receiver' in [x[0] for x in resp.form['by$element0'].options]
|
||||
|
||||
|
||||
def test_workflows_edit_choice_action_line_details(pub):
|
||||
create_superuser(pub)
|
||||
create_role()
|
||||
|
||||
Workflow.wipe()
|
||||
wf = Workflow(name='foo')
|
||||
st1 = wf.add_status('New')
|
||||
st2 = wf.add_status('Resubmit')
|
||||
|
||||
jump = ChoiceWorkflowStatusItem()
|
||||
jump.id = '1'
|
||||
jump.parent = st1
|
||||
st1.items.append(jump)
|
||||
wf.store()
|
||||
|
||||
app = login(get_app(pub))
|
||||
resp = app.get('/backoffice/workflows/%s/status/%s/' % (wf.id, st1.id))
|
||||
assert resp.html.find('a', {'href': 'items/1/'}).text == 'Manual Jump (not completed)'
|
||||
|
||||
jump.label = 'Resubmit'
|
||||
wf.store()
|
||||
resp = app.get('/backoffice/workflows/%s/status/%s/' % (wf.id, st1.id))
|
||||
assert resp.html.find('a', {'href': 'items/1/'}).text == \
|
||||
'Manual Jump (not completed)'
|
||||
|
||||
jump.status = st2.id
|
||||
wf.store()
|
||||
resp = app.get('/backoffice/workflows/%s/status/%s/' % (wf.id, st1.id))
|
||||
assert resp.html.find('a', {'href': 'items/1/'}).text == \
|
||||
'Manual Jump ("Resubmit", to Resubmit)'
|
||||
|
||||
jump.label = 'Resubmit'
|
||||
wf.store()
|
||||
resp = app.get('/backoffice/workflows/%s/status/%s/' % (wf.id, st1.id))
|
||||
assert resp.html.find('a', {'href': 'items/1/'}).text == \
|
||||
'Manual Jump ("Resubmit", to Resubmit)'
|
||||
|
||||
jump.set_marker_on_status = True
|
||||
wf.store()
|
||||
resp = app.get('/backoffice/workflows/%s/status/%s/' % (wf.id, st1.id))
|
||||
assert resp.html.find('a', {'href': 'items/1/'}).text == \
|
||||
'Manual Jump ("Resubmit", to Resubmit (and set marker))'
|
||||
|
||||
jump.set_marker_on_status = False
|
||||
jump.by = ['_submitter']
|
||||
wf.store()
|
||||
resp = app.get('/backoffice/workflows/%s/status/%s/' % (wf.id, st1.id))
|
||||
assert resp.html.find('a', {'href': 'items/1/'}).text == \
|
||||
'Manual Jump ("Resubmit", to Resubmit, by User)'
|
||||
|
||||
jump.set_marker_on_status = True
|
||||
wf.store()
|
||||
resp = app.get('/backoffice/workflows/%s/status/%s/' % (wf.id, st1.id))
|
||||
assert resp.html.find('a', {'href': 'items/1/'}).text == \
|
||||
'Manual Jump ("Resubmit", to Resubmit, by User (and set marker))'
|
||||
|
||||
|
||||
def test_workflows_action_subpath(pub):
|
||||
create_superuser(pub)
|
||||
create_role()
|
||||
|
|
|
@ -2441,21 +2441,24 @@ class ChoiceWorkflowStatusItem(WorkflowStatusJumpItem):
|
|||
return _('computed label')
|
||||
|
||||
def get_line_details(self):
|
||||
if self.label:
|
||||
if self.label and self.status:
|
||||
to_status = self.parent.parent.get_status(self.status)
|
||||
more = ''
|
||||
if self.set_marker_on_status:
|
||||
more += ' ' + _('(and set marker)')
|
||||
if self.by:
|
||||
return _('"%(label)s" by %(by)s%(more)s') % {
|
||||
'label' : self.get_label(),
|
||||
'by' : self.render_list_of_roles(self.by),
|
||||
'more': more
|
||||
}
|
||||
return _('"%(label)s", to %(to)s, by %(by)s%(more)s') % {
|
||||
'label': self.get_label(),
|
||||
'to': to_status.name,
|
||||
'by': self.render_list_of_roles(self.by),
|
||||
'more': more
|
||||
}
|
||||
else:
|
||||
return _('"%(label)s"%(more)s') % {
|
||||
'label': self.get_label(),
|
||||
'more': more
|
||||
}
|
||||
return _('"%(label)s", to %(to)s%(more)s') % {
|
||||
'label': self.get_label(),
|
||||
'to': to_status.name,
|
||||
'more': more
|
||||
}
|
||||
else:
|
||||
return _('not completed')
|
||||
|
||||
|
|
Loading…
Reference in New Issue