~crass/tryton/server

« back to all changes in this revision

Viewing changes to trytond/test/workflow.py

  • Committer: Mathias Behrle
  • Date: 2013-11-24 16:28:54 UTC
  • Revision ID: git-v1:182d6cce169eab1682eeacbad4323efa1136a1a0
MergingĀ upstreamĀ versionĀ 3.0.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# This file is part of Tryton.  The COPYRIGHT file at the top level of this
2
 
# repository contains the full copyright notices and license terms.
3
 
 
4
 
from trytond.model import ModelSQL, Workflow, fields
5
 
 
6
 
__all__ = [
7
 
    'WorkflowedModel',
8
 
    ]
9
 
 
10
 
 
11
 
class WorkflowedModel(Workflow, ModelSQL):
12
 
    'Workflowed Model'
13
 
    __name__ = 'test.workflowed'
14
 
    state = fields.Selection([
15
 
            ('start', 'Start'),
16
 
            ('running', 'Running'),
17
 
            ('end', 'End'),
18
 
            ], 'State')
19
 
 
20
 
    @classmethod
21
 
    def __setup__(cls):
22
 
        super(WorkflowedModel, cls).__setup__()
23
 
        cls._transitions |= set((
24
 
                ('start', 'running'),
25
 
                ))
26
 
 
27
 
    @staticmethod
28
 
    def default_state(cls):
29
 
        return 'start'
30
 
 
31
 
    @classmethod
32
 
    @Workflow.transition('running')
33
 
    def run(cls, records):
34
 
        pass