Odoo includes a built in workflow engine used to manage business document flows and interaction. However, this engine has been gradually replaced by Python business logic and automated actions. As an example of this, one of the most important workflows used to be the one linking sales orders, invoices, and deliveries, but since version 9.0, it has been removed.
But, there are a few workflows still used by some apps, so there may be cases where a developer will need to work with them. So it's still relevant to have some basic understanding of how they work.
The Marketing Campaigns app still uses a simple workflow, and we will use it to provide this brief overview on them.
We will need an Odoo instance with demo data and the Marketing Campaign's addon module installed (not that it's not an app). We also need to have the Developer Mode activated. If it's not, activate it in the Odoo About dialog.
To inspect the workflow defined on a model, follow these steps:
The workflow definitions are stored in the workflow
model, and are also reachable through the Settings top menu, and navigate to Technical | Workflows menu item.
Their definition has Activities. The nodes or workflow states, and Transitions, defining when a workflow's current state should move to another node.
Transitions often depend on a workflow Signal to be triggered. A common way to trigger a workflow signal is through form buttons. Buttons support a type="workflow"
attribute for this.
Existing workflows are customizable: we can edit or add activities, and we can change the Transitions connecting them. Simple customizations usually involve editing a transition. In the workflow diagram, double clicking a transition arrow brings up its form view. There we rewire the workflow by modifying Destination Activity, adding Condition with a Python expression to evaluate, or using Group Required to limit the transition to be triggered only by users in a certain security group.