workflows: enhance default workflow to mail comments when in 'new' status
This commit is contained in:
parent
93cf9ff1bc
commit
ed8b18268f
|
@ -217,13 +217,20 @@ class Workflow(StorableObject):
|
|||
just_submitted_status = workflow.add_status(_('Just Submitted'), 'just_submitted')
|
||||
just_submitted_status.visibility = ['_receiver']
|
||||
new_status = workflow.add_status(_('New'), 'new')
|
||||
handled_status = workflow.add_status(_('Handled'), 'handled')
|
||||
rejected_status = workflow.add_status(_('Rejected'), 'rejected')
|
||||
accepted_status = workflow.add_status(_('Accepted'), 'accepted')
|
||||
finished_status = workflow.add_status(_('Finished'), 'finished')
|
||||
|
||||
commentable = CommentableWorkflowStatusItem()
|
||||
commentable.id = '_commentable'
|
||||
commentable.by = ['_submitter', '_receiver']
|
||||
commentable.by = ['_receiver']
|
||||
commentable.button_label = _('Add Comment')
|
||||
|
||||
commentable_all = CommentableWorkflowStatusItem()
|
||||
commentable_all.id = '_commentable_all'
|
||||
commentable_all.by = ['_submitter', '_receiver']
|
||||
commentable_all.button_label = _('Add Comment')
|
||||
|
||||
import wf.jump
|
||||
jump_to_new = wf.jump.JumpWorkflowStatusItem()
|
||||
|
@ -231,6 +238,11 @@ class Workflow(StorableObject):
|
|||
jump_to_new.status = new_status.id
|
||||
jump_to_new.parent = just_submitted_status
|
||||
|
||||
jump_to_handled = JumpOnSubmitWorkflowStatusItem()
|
||||
jump_to_handled.id = '_jump_to_handled'
|
||||
jump_to_handled.status = handled_status.id
|
||||
jump_to_handled.parent = new_status
|
||||
|
||||
notify_new_receiver_email = SendmailWorkflowStatusItem()
|
||||
notify_new_receiver_email.id = '_notify_new_receiver_email'
|
||||
notify_new_receiver_email.to = ['_receiver']
|
||||
|
@ -272,15 +284,18 @@ class Workflow(StorableObject):
|
|||
|
||||
if notify_change_receiver_email:
|
||||
accepted_status.items.append(notify_change_receiver_email)
|
||||
handled_status.items.append(notify_change_receiver_email)
|
||||
rejected_status.items.append(notify_change_receiver_email)
|
||||
finished_status.items.append(notify_change_receiver_email)
|
||||
if notify_change_user_email:
|
||||
accepted_status.items.append(notify_change_user_email)
|
||||
handled_status.items.append(notify_change_user_email)
|
||||
rejected_status.items.append(notify_change_user_email)
|
||||
finished_status.items.append(notify_change_user_email)
|
||||
|
||||
new_status.items.append(commentable)
|
||||
accepted_status.items.append(commentable)
|
||||
accepted_status.items.append(commentable_all)
|
||||
handled_status.items.append(commentable_all)
|
||||
|
||||
accept = ChoiceWorkflowStatusItem()
|
||||
accept.id = '_accept'
|
||||
|
@ -289,6 +304,7 @@ class Workflow(StorableObject):
|
|||
accept.status = accepted_status.id
|
||||
accept.parent = new_status
|
||||
new_status.items.append(accept)
|
||||
handled_status.items.append(accept)
|
||||
|
||||
reject = ChoiceWorkflowStatusItem()
|
||||
reject.id = '_reject'
|
||||
|
@ -297,6 +313,9 @@ class Workflow(StorableObject):
|
|||
reject.status = rejected_status.id
|
||||
reject.parent = new_status
|
||||
new_status.items.append(reject)
|
||||
handled_status.items.append(reject)
|
||||
|
||||
new_status.items.append(jump_to_handled)
|
||||
|
||||
finish = ChoiceWorkflowStatusItem()
|
||||
finish.id = '_finish'
|
||||
|
|
Loading…
Reference in New Issue