Contributors mailing list archives

contributors@odoo-community.org

Keeping workflows

by
XCG Consulting, Houzéfa Abbasbhay
- 24/10/2017 09:22:25
Hi,

As you probably know:
- Odoo 10 no longer uses any workflow in addons it provides, but the 
workflow system is still there should one want to use it.
- Workflows are gone in Odoo 11 (as mentioned on 
).

Over the years we have used workflows quite a bit with my colleagues and 
have found several interesting properties there that would be cumbersome 
to redo "by hand" (public methods / "write" override / whathaveyou) - 
see below for a (non exhaustive) pros & cons list.

I would like to know other people's ideas about this, and which 
alternatives you have in mind. Here are some I have thought of:
1) Mixin provided by an OCA addon
2) OCB support
3) Action rules (base_action_rule addon)

#1 is what I will inevitably end up doing to (at the very least) avoid 
some code duplication for the basic pros listed below. That could evolve 
into a whole workflow management system like the previous one if you 
experts believe this is the best alternative...

Pros:
- Transitions: Check the previous state when flowing to the next one.
- Automatic transitions based on fields of the object.
- Security per transition.
- Independent workflow "branches" within the same workflow, sometimes 
linked to a sub-flow (eg "invoicing" & "stock management" branches in 
the sales order workflow).
- Multiple workflows per object.
- Workflow diagrams are easy to grasp by just looking at them - some 
details are of course hidden in the code but overall quite explicit.

Cons:
- Old code, always a dreadful task to delve into.
- Multiple workflows per object: Ordering issues, especially when 
relying on auto-transitions as well (implementation issue; on paper the 
concept is appealing).
- Need scripts to apply a workflow onto lots of existing objects or to 
update states desynchronized with their workflow tracking elements 
(again, implementation issue that could be made easier).

I also want to mention workflow transitions are run in the same 
transaction as their trigger; not sure whether that is a pro or a con...

What do you think about keeping workflows?
Thanks!
-- 
Houzéfa Abbasbhay
XCG Consulting - Innovator
houzefa.abba@xcg-consulting.fr