workflows: add an initial 'just submitted' status to default workflow
This is required as we want the 'new submitted form' email to be sent only once.
This commit is contained in:
parent
decdb1ecac
commit
a7e2990af4
|
@ -199,6 +199,7 @@ class Workflow(StorableObject):
|
|||
|
||||
workflow = Workflow(name=_('Default'))
|
||||
workflow.id = '_default'
|
||||
just_submitted_status = workflow.add_status(_('Just Submitted'), 'just_submitted')
|
||||
new_status = workflow.add_status(_('New'), 'new')
|
||||
rejected_status = workflow.add_status(_('Rejected'), 'rejected')
|
||||
accepted_status = workflow.add_status(_('Accepted'), 'accepted')
|
||||
|
@ -208,6 +209,12 @@ class Workflow(StorableObject):
|
|||
commentable.id = '_commentable'
|
||||
commentable.by = ['_submitted', '_receiver']
|
||||
|
||||
import wf.jump
|
||||
jump_to_new = wf.jump.JumpWorkflowStatusItem()
|
||||
jump_to_new.id = '_jump_to_new'
|
||||
jump_to_new.status = new_status.id
|
||||
jump_to_new.parent = just_submitted_status
|
||||
|
||||
notify_new_receiver_email = SendmailWorkflowStatusItem()
|
||||
notify_new_receiver_email.id = '_notify_new_receiver_email'
|
||||
notify_new_receiver_email.to = ['_receiver']
|
||||
|
@ -241,9 +248,11 @@ class Workflow(StorableObject):
|
|||
notify_change_user_email = None
|
||||
|
||||
if notify_new_receiver_email:
|
||||
new_status.items.append(notify_new_receiver_email)
|
||||
just_submitted_status.items.append(notify_new_receiver_email)
|
||||
if notify_new_user_email:
|
||||
new_status.items.append(notify_new_user_email)
|
||||
just_submitted_status.items.append(notify_new_user_email)
|
||||
|
||||
just_submitted_status.items.append(jump_to_new)
|
||||
|
||||
if notify_change_receiver_email:
|
||||
accepted_status.items.append(notify_change_receiver_email)
|
||||
|
|
Loading…
Reference in New Issue