workflows: play actions if jumping to current status from global action (#57750)
This commit is contained in:
parent
9276e5f547
commit
b6a5e90708
|
@ -6026,10 +6026,10 @@ def test_user_global_action_same_status_store(pub):
|
|||
assert 'button-action-1' in resp.form.fields
|
||||
resp = resp.form.submit('button-action-1') # click global action
|
||||
|
||||
# check status actions are not rerun
|
||||
# check status actions are rerun
|
||||
resp = app.get(formdata.get_url())
|
||||
assert formdef.data_class().get(formdata.id).status == 'wf-new'
|
||||
assert formdef.data_class().get(formdata.id).data['bo1'] == '123'
|
||||
assert formdef.data_class().get(formdata.id).data['bo1'] == '321'
|
||||
|
||||
|
||||
def test_anonymous_user_global_action(pub):
|
||||
|
|
|
@ -591,7 +591,7 @@ class FormData(StorableObject):
|
|||
for action in self.formdef.workflow.get_global_actions_for_user(formdata=self, user=user):
|
||||
if action.id != action_id:
|
||||
continue
|
||||
return perform_items(action.items, self, event=(event_name, action.id))
|
||||
return perform_items(action.items, self, event=(event_name, action.id), global_action=True)
|
||||
|
||||
def get_workflow_messages(self, position='top', user=None):
|
||||
wf_status = self.get_visible_status(user=user)
|
||||
|
|
|
@ -70,7 +70,7 @@ def lax_int(s):
|
|||
return -1
|
||||
|
||||
|
||||
def perform_items(items, formdata, depth=20, event=None):
|
||||
def perform_items(items, formdata, depth=20, event=None, global_action=False):
|
||||
if depth == 0: # prevents infinite loops
|
||||
return
|
||||
url = None
|
||||
|
@ -96,7 +96,7 @@ def perform_items(items, formdata, depth=20, event=None):
|
|||
if formdata.id:
|
||||
# don't save formdata it has been removed
|
||||
formdata.store()
|
||||
if formdata.status != old_status:
|
||||
if formdata.status != old_status or (global_action and 'jump' in [x[1] for x in performed_actions]):
|
||||
if not formdata.evolution:
|
||||
formdata.evolution = []
|
||||
evo = Evolution()
|
||||
|
|
Loading…
Reference in New Issue