Files
tryton/trytond/tests/workflow.py
T

34 lines
834 B
Python
Raw Normal View History

# This file is part of Tryton. The COPYRIGHT file at the top level of this
# repository contains the full copyright notices and license terms.
2012-03-25 00:15:17 +01:00
from trytond.model import ModelSQL, Workflow, fields
2012-09-24 22:16:53 +02:00
__all__ = [
'WorkflowedModel',
]
2012-03-25 00:15:17 +01:00
class WorkflowedModel(Workflow, ModelSQL):
2012-09-24 22:16:53 +02:00
'Workflowed Model'
__name__ = 'test.workflowed'
2012-03-25 00:15:17 +01:00
state = fields.Selection([
('start', 'Start'),
('running', 'Running'),
('end', 'End'),
], 'State')
2012-09-24 22:16:53 +02:00
@classmethod
def __setup__(cls):
super(WorkflowedModel, cls).__setup__()
cls._transitions |= set((
2012-03-25 00:15:17 +01:00
('start', 'running'),
))
2012-09-24 22:16:53 +02:00
@staticmethod
2013-12-23 00:34:25 +01:00
def default_state():
2012-03-25 00:15:17 +01:00
return 'start'
2012-09-24 22:16:53 +02:00
@classmethod
2012-03-25 00:15:17 +01:00
@Workflow.transition('running')
2012-09-24 22:16:53 +02:00
def run(cls, records):
2012-03-25 00:15:17 +01:00
pass