Custom workflow together with Custom App

Hi

I have created a custom App with a few new doctypes. Working fine.
It does work nicely if there is also a workflow defined together with it.
I would like to also push the workflow to Github so that when someone else
uses the app, the workflow is also installed.

So essentially, when I push the App to Github, it must contain the doctypes
as well as the workflow.

I saw this video from Hussain

https://www.google.com/search?client=ubuntu-sn&channel=fs&q=bench+export-fixtures#fpstate=ive&vld=cid:cfb8c8f1,vid:fFEpiZbNjB0,st:0

So based on this, I would think that I should do the following…

New doctype name = new_doc ( create all fields etc for new_doc )
workflow for new_doc = new_doc_workflow
(create this workflow with all its states and flow-definitions)

Then in …/apps/custom_app/custom_app/hooks.py , I must insert…

fixtures = [
    {
        "dt": "Workflow", 
        "filters": [
            ["document_type", "=", "New_Doc"]
        ]
    }
]

then just before I push to github , I must …

bench export-fixtures

then I end with the procedure to push the app to github?

Am i on the right track?

To export the workflow, you just have to define it in fixtures like you already did in hooks.py file, and also don’t forget to export workflow states if you are adding new workflow states.
and run bench export command

Thank you for your comment @ejaaz

Thank you for mentioning the Workflow States as well. That slipped my
attention.

It seems I will have to consider carefully what I have to export. If I have custom
roles in my workflow then I will have to export those as well ??

Yes, you can export custom roles, but check if there is any performance issue while migrating with roles because I used to export custom roles initially, which led to a performance issue. Therefore, I stopped exporting roles via fixtures, and I don’t know if it is solved yet.

Thank you for bringing this to my attention, @ejaaz I shall visit the link and look at the material.

Appreciate your time

1 Like