wf/jump: store marker before jump, not after (#23033)
This commit is contained in:
parent
0fd0e62ab0
commit
5af4dd6d5e
|
@ -3643,16 +3643,20 @@ def test_workflow_jump_previous_auto(pub):
|
|||
formdata.store()
|
||||
formdata.perform_workflow()
|
||||
assert formdata.status == 'wf-south'
|
||||
assert formdata.workflow_data['_markers_stack']
|
||||
assert formdata.workflow_data['_markers_stack'] == [{'status_id': 'north'}]
|
||||
|
||||
app = login(get_app(pub))
|
||||
resp = app.get('/backoffice/management/form-title/%s/' % formdata.id)
|
||||
resp = resp.form.submit('button_back')
|
||||
resp = resp.follow()
|
||||
|
||||
# jumped and got back
|
||||
assert formdef.data_class().get(formdata.id).status == 'wf-south'
|
||||
assert not formdef.data_class().get(formdata.id).workflow_data['_markers_stack']
|
||||
# jumped and got back to north, then re-jump to south again (auto-jump)
|
||||
formdata = formdef.data_class().get(formdata.id)
|
||||
statuses = [evo.status for evo in formdata.evolution]
|
||||
assert statuses == ['wf-north', 'wf-south', 'wf-north', 'wf-south']
|
||||
# formdata went through north->south auto-jump again, status and marker are still here
|
||||
assert formdata.status == 'wf-south'
|
||||
assert formdata.workflow_data['_markers_stack'] == [{'status_id': 'north'}]
|
||||
|
||||
def test_backoffice_fields(pub):
|
||||
user = create_user(pub)
|
||||
|
|
|
@ -215,8 +215,8 @@ class JumpWorkflowStatusItem(WorkflowStatusJumpItem):
|
|||
if self.must_jump(formdata):
|
||||
wf_status = self.get_target_status(formdata)
|
||||
if wf_status:
|
||||
formdata.status = 'wf-%s' % wf_status[0].id
|
||||
self.handle_markers_stack(formdata)
|
||||
formdata.status = 'wf-%s' % wf_status[0].id
|
||||
|
||||
def must_jump(self, formdata):
|
||||
must_jump = True
|
||||
|
|
Loading…
Reference in New Issue