Possible to define workflow in app?

Is it possible to define a document workflow in an app (via the doctype controller, or something else)? I feel like I should be able to find an answer to this on these forums, but my searching isn’t turning up much.

Can you elaborate further what you exactly want. ? An example perhaps.

Sure. We’ve created a new doctype, Service Order, which contains a lot of logic related to maintenance visits, ordering spare parts, warranty claims, billing, etc.

We’d like some of that logic to depend on workflow_state, but at present that seems like a bad practice to have a document controller relying on something defined client-side. Moreover, if we install the app that contains Service Order on a new site, we have to manually create the workflow.

What we’d like to do is define the workflow in something packaged with the doctype (such as the doctype controller python file). Does that make sense?

Did you try exporting fixtures with your app? check Fixtures Support - filters


Thanks Revant. Your advice, as always, is spot on. I had completely misunderstood how fixtures worked, thinking they were for doctype customizations. This works great.