No transition from ASSIGNED viewflow

182 views Asked by At

Previously i had an issue with viewflow as i was attempting to assign the process pk to a foreign key field. It seems like the issue has been resolved , however i am recieving another message error as seen below

No transition from ASSIGNED

It seems like the error may be coming from my flows.py :

class Pipeline(Flow):
process_class = PaymentVoucherProcess

start = (
    flow.Start( 
        CreateProcessView,
        fields=["payment_code","bPBankAccount"]
    ).Permission(
        auto_create=True
    ).Next(this.approve)
)

approve = (
    flow.View(
        Signature,
        fields=["eSignatureModel"]
    ).Permission(
        auto_create=True
    ).Next(this.check_approve)
)

check_approve = (
    flow.If(lambda activation: activation.process.eSignatureModel)
    .Then(this.send)
    .Else(this.end)
)

send = (
    flow.Handler(
        this.send_hello_world_request
    ).Next(this.end)
)

end = flow.End()

def send_hello_world_request(self, activation):
    print(activation.process.payment_code)

or my views.py:

@flow_view
def Signature(request):
    form = SignatureForm(request.POST or None)
    if form.is_valid():
        esig = form.save(commit=False)
        signature = form.cleaned_data.get('signature')
        if signature:
            signature_picture = draw_signature(signature)
            signature_file_path = draw_signature(signature, as_file=True)
        esig.paymentVoucherProcess = request.activation.process
        esig.save()
        request.activation.done()
        return redirect(get_next_task_url(request, request.activate_next.process))

    return render(request, 'cash/pipeline/jsig.html', {
        'form': form,
        'activation': request.activation
    })

Google doesn't give me much information on how to debug this , maybe someone with experience can assist me? I would greatly appreciate it!

1

There are 1 answers

0
kmmbvnr On

Seems you miss activation.prepare call.

For the custom views sample, you could the Viewflow cookbook - https://github.com/viewflow/cookbook/blob/master/custom_views/demo/bloodtest/views.py#L33