0

我目前正在尝试重新创建此流程:

在此处输入图像描述

到目前为止,我的流程只有一个方向,没有退后一步的选择,假设人'b'发现人'a'键入的错误,我希望能够允许人'b'将任务发送回人“a”,以便他们可以“编辑”他们的条目。但是,视图流中似乎没有“编辑”功能,这是有原因的吗?

流.py

class Pipeline(Flow):
    process_class = PaymentVoucherProcess
    lock_impl = lock.select_for_update_lock
    #process starts here
    start = flow.Start(
        PVStartView,
        task_title="Processing New Voucher"
    ).Permission("cash.can_start_voucher"
    ).Next(this.approve_by_preparer)
    
    #preparer will approve
    approve_by_preparer = flow.View(
        UpdateProcessView,
        form_class=PreparerApproveForm,
        task_title="Approval By Preparer"
    ).Assign(lambda act: act.process.assign_preparer
    ).Permission("cash.preparer"
    ).Next(this.documents)

    #preparer will upload supporting documents
    documents = flow.View(
        UploadView,
        task_title="Recieving Supporting Documents"
    ).Assign(lambda act: act.process.assign_preparer
    ).Permission("cash.preparer"
    ).Next(this.preparer)

    #preparer will sign
    preparer = flow.View(
        PreparerSignature,
        task_title="Signature By Preparer"
    ).Assign(lambda act: act.process.assign_preparer
    ).Permission("cash.preparer"
    ).Next(this.approve_by_verifier)

    #system check point
    check_treasury = flow.If(
        cond=lambda act: act.process.preparer,
        task_title="Processing",
    ).Then(this.approve_by_verifier).Else(this.end)

    #verifier will sign
    approve_by_verifier = flow.View(
        UpdateProcessView,
        form_class=VerifierApproveForm,
        task_title="Approval By Verifier"
    ).Assign(lambda act: act.process.assign_verifier
    ).Permission("cash.verifier"
    ).Next(this.verifier)
    #there is more but not relevant 

我知道有一些“撤消”混合视图,但我不确定在我的案例中它是如何实现的,以及一切是如何编排的,请帮忙!

4

2 回答 2

0

Undo任务流是管理功能的一部分,通常不适合使用。如果您需要按用户编辑流程数据a,您可以简单地为用户创建编辑任务a

check = flow.If().Then(...).Else(this.edit_by_a)

edit_by_a = flow.View().Assign(this.start.owner).Next(this.check)
于 2021-01-26T05:32:49.650 回答
0

我仍然不知道如何正确地做到这一点。但这是我在此期间所做的:

流.py

class Pipeline(Flow):
process_class = PaymentVoucherProcess
lock_impl = lock.select_for_update_lock
#process starts here
start = flow.Start(
    PVStartView,
    task_title="Processing New Voucher"
).Permission("cash.can_start_voucher"
).Next(this.approve_by_preparer)

#preparer will approve
approve_by_preparer = flow.View(
    UpdateProcessView,
    form_class=PreparerApproveForm,
    task_title="Approval By Preparer"
).Assign(lambda act: act.process.assign_preparer
).Permission("cash.preparer"
).Next(this.check_preparer)

#system check point
check_preparer = flow.If(
    cond=lambda act: act.process.preparer,
    task_title="Processing",
).Then(this.documents).Else(this.roll_back)

roll_back = flow.Handler(this.roll_back_call).Next(this.approve_by_preparer)

#preparer will upload supporting documents
documents = flow.View(
    UploadView,
    task_title="Recieving Supporting Documents"
).Assign(lambda act: act.process.assign_preparer
).Permission("cash.preparer"
).Next(this.preparer)

#preparer will sign
preparer = flow.View(
    PreparerSignature,
    task_title="Signature By Preparer"
).Assign(lambda act: act.process.assign_preparer
).Permission("cash.preparer"
).Next(this.approve_by_verifier)

#verifier will sign
approve_by_verifier = flow.View(
    UpdateProcessView,
    form_class=VerifierApproveForm,
    task_title="Approval By Verifier"
).Assign(lambda act: act.process.assign_verifier
).Permission("cash.verifier"
).Next(this.check_verifier)

#system check point
check_verifier = flow.If(
    cond=lambda act: act.process.verifier,
    task_title="Processing"
).Then(this.verifier).Else(this.roll_back)
#bunch of code here and inbetween


end = flow.End()

def roll_back_call(self, activation):
    esig = ESignatures.objects.filter(paymentVoucherProcess = activation.process).filter(voided = False)
    docu = Attachment.objects.filter(paymentVoucherProcess = activation.process).filter(voided = False)
    if len(esig) > 0 :
        for sig in esig:
            sig.voided = True
            sig.save()
    if len(docu) > 0 :
        for doc in docu:
            doc.voided = True
            doc.save()
    activation.process.preparer = False
    activation.process.verifier = False
    activation.process.treasury = False
    activation.process.director = False

基本上,此回滚处理程序中发生的情况是,当程序发现人员“B”不赞成时,它将运行搜索进程并“刷新”它的 roll_back 代码,将所有外部关系标记为无效并删除所有先前的批准。这真的是超级非正统和骇人听闻的,但在此期间它有效,请让我知道你们的评论并与我分享你的答案。

我仍然没有弄清楚一个人究竟如何“编辑”或“取消”或“重新分配”他的任务,文档没有太多,我真的很惊讶人们没有面临这样的问题,因为内容严重缺乏那里 。无论如何,我希望看到一些建设性的反馈!

于 2020-04-07T10:58:05.413 回答