Workflow has no attribute _transitions

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(, __file__, 'exec'))
  File "/home/xcodinas/projectes/develop/trytond/bin/trytond-admin", line 21, in <module>
  File "/home/xcodinas/projectes/develop/trytond/trytond/", line 54, in run
  File "/home/xcodinas/projectes/develop/trytond/trytond/", line 160, in init
    lang=lang, activatedeps=activatedeps)
  File "/home/xcodinas/projectes/develop/trytond/trytond/modules/", line 418, in load_modules
  File "/home/xcodinas/projectes/develop/trytond/trytond/modules/", line 388, in _load_modules
    load_module_graph(graph, pool, update, lang)
  File "/home/xcodinas/projectes/develop/trytond/trytond/modules/", line 201, in load_module_graph
  File "/home/xcodinas/projectes/develop/trytond/trytond/", line 234, in setup
  File "/home/xcodinas/projectes/develop/trytond/trytond/modules/purchase_intake/", 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?

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)).

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.

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.

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