# Workflow has no attribute \_transitions

**URL:** https://discuss.tryton.org/t/workflow-has-no-attribute-transitions/1666
**Category:** Developer
**Created:** [August 19, 2019, 3:41pm UTC](https://discuss.tryton.org/t/workflow-has-no-attribute-transitions/1666 "2019-08-19T15:41:58Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![xcodinas](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/xcodinas/32/336_2.png) [@xcodinas](https://discuss.tryton.org/u/xcodinas)
#### Post date: [August 19, 2019, 3:41pm UTC](https://discuss.tryton.org/t/workflow-has-no-attribute-transitions/1666/1 "2019-08-19T15:41:58Z")

</div>

Hello,  
I’m trying to use the workflow mixin in my model but It’s giving me this error:

```
Traceback (most recent call last):
  File "/home/xcodinas/.virtualenvs/develop/bin/trytond-admin", line 7, in <module>
    exec(compile(f.read(), __file__ , 'exec'))
  File "/home/xcodinas/projectes/develop/trytond/bin/trytond-admin", line 21, in <module>
    admin.run(options)
  File "/home/xcodinas/projectes/develop/trytond/trytond/admin.py", line 54, in run
    activatedeps=options.activatedeps)
  File "/home/xcodinas/projectes/develop/trytond/trytond/pool.py", line 160, in init
    lang=lang, activatedeps=activatedeps)
  File "/home/xcodinas/projectes/develop/trytond/trytond/modules/ __init__.py", line 418, in load_modules
    _load_modules(update)
  File "/home/xcodinas/projectes/develop/trytond/trytond/modules/ __init__.py", line 388, in _load_modules
    load_module_graph(graph, pool, update, lang)
  File "/home/xcodinas/projectes/develop/trytond/trytond/modules/ __init__.py", line 201, in load_module_graph
    pool.setup(classes)
  File "/home/xcodinas/projectes/develop/trytond/trytond/pool.py", line 234, in setup
    cls. __setup__ ()
  File "/home/xcodinas/projectes/develop/trytond/trytond/modules/purchase_intake/purchase.py", line 137, in __setup__
    cls._transitions |= set((
AttributeError: type object 'purchase.intake' has no attribute '_transitions'

```

i’m defining the class this way:

```
class PurchaseIntake(ModelSQL, ModelView, Workflow):
    'Purchase Intake'
    __name__ = 'purchase.intake'

```

Any idea on what I’m doing wrong?

---

<div class="post-metadata">

### Author: ![albert](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/albert/32/21_2.png) [@albert](https://discuss.tryton.org/u/albert)
#### Post date: [August 19, 2019, 4:12pm UTC](https://discuss.tryton.org/t/workflow-has-no-attribute-transitions/1666/2 "2019-08-19T16:12:22Z")

</div>

My guess would be that either you’re not calling super() or that Workflow should be the first parent of the class (ie (Workflow, ModelSQL, ModelView) instead of (ModelSQL, ModelView, Workflow)).

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [August 19, 2019, 4:34pm UTC](https://discuss.tryton.org/t/workflow-has-no-attribute-transitions/1666/3 "2019-08-19T16:34:27Z")

</div>

> [@albert](#):
>
> that Workflow should be the first parent of the class

This is the requirement because Workflow does not inherit from any Model but it is using their attribute.

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [August 20, 2019, 7:02am UTC](https://discuss.tryton.org/t/workflow-has-no-attribute-transitions/1666/4 "2019-08-20T07:02:15Z")

</div>

> [@ced](#):
>
> This is the requirement because Workflow does not inherit from any Model but it is using their attribute.

I’m wondering if it makes sense that Workflow inherits from Model to prevent this kind of errors.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [August 20, 2019, 7:36am UTC](https://discuss.tryton.org/t/workflow-has-no-attribute-transitions/1666/5 "2019-08-20T07:36:56Z")

</div>

The problem is that it overrides `copy` which is defined in `ModelStorage`. But do we want to force to use `Workflow` only with `ModelStorage`? `transition` decorator uses `write` method which seems to make it only works with at least a `ModelStorage`.

If we go this way, `DictSchemaMixin`, `MultiValueMixin`, `SequenceOrderedMixin`, `TreeMixin` and `UnionMixin` should be revisited also.

This may break some existing code that uses those Mixin in a different way.

---

<div class="post-metadata">

### Author: ![system](https://discuss-cdn.tryton.org/uploads/default/original/1X/c6f8ec0a40525cdcd50058c734283450a4b3d38b.png) [@system](https://discuss.tryton.org/u/system)
#### Post date: [September 19, 2019, 7:37am UTC](https://discuss.tryton.org/t/workflow-has-no-attribute-transitions/1666/6 "2019-09-19T07:37:13Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
