source: main/kofacustom.ekodisco/trunk/src/kofacustom/ekodisco/students/workflow.py @ 11088

Last change on this file since 11088 was 10815, checked in by Henrik Bettermann, 11 years ago

Show proper workflow states.

  • Property svn:keywords set to Id
File size: 2.8 KB
RevLine 
[10806]1"""Workflow for students.
2"""
3import grok
4from datetime import datetime
5from zope.component import getUtility
6from hurry.workflow.workflow import Transition, WorkflowState, NullCondition
7from hurry.workflow.interfaces import IWorkflowState, IWorkflowTransitionEvent
8from waeup.kofa.interfaces import (
9    IObjectHistory, IKofaWorkflowInfo, IKofaUtils,
10    CREATED, ADMITTED, CLEARANCE, REQUESTED, CLEARED, PAID, RETURNING,
11    REGISTERED, VALIDATED, GRADUATED, TRANSCRIPT)
12from waeup.kofa.interfaces import MessageFactory as _
13from waeup.kofa.workflow import KofaWorkflow, KofaWorkflowInfo
14from waeup.kofa.students.interfaces import IStudent, IStudentsUtils
15from waeup.kofa.students.workflow import RegistrationWorkflowInfo
16
17
18REGISTRATION_TRANSITIONS = (
19    Transition(
20        transition_id = 'create',
21        title = _('Create customer'),
22        source = None,
23        condition = NullCondition,
24        msg = _('Record created'),
25        destination = CREATED),
26
27    Transition(
28        transition_id = 'admit',
[10815]29        title = _('Approve subscription'),
30        msg = _('Subscription approved'),
[10806]31        source = CREATED,
[10812]32        destination = CLEARED),
[10806]33
34    Transition(
35        transition_id = 'reset1',
36        title = _('Reset customer to initial state'),
37        msg = _('Reset to initial state'),
[10812]38        source = CLEARED,
[10806]39        destination = CREATED),
40
41    Transition(
[10812]42        transition_id = 'pay_first_school_fee',
43        title = _('Pay first meter fee'),
44        msg = _('First meter fee payment made'),
45        source = CLEARED,
46        destination = PAID),
47
48    Transition(
49        transition_id = 'approve_first_school_fee',
50        title = _('Approve first meter payment'),
51        msg = _('First meter fee payment approved'),
52        source = CLEARED,
53        destination = PAID),
54
55    # The pg fee payment has proper handlers which suit
56    # customer payments.
57
58    Transition(
59        transition_id = 'pay_pg_fee',
[10806]60        title = _('Pay meter fee'),
61        msg = _('Meter fee paid'),
[10812]62        source = PAID,
[10806]63        destination = PAID),
64
65    Transition(
[10812]66        transition_id = 'approve_pg_fee',
[10806]67        title = _('Approve meter fee payment'),
68        msg = _('Meter fee payment approved'),
[10812]69        source = PAID,
[10806]70        destination = PAID),
71
72    Transition(
73        transition_id = 'reset2',
[10815]74        title = _("Reset customer to state 'subscription approved'"),
75        msg = _("Reset to state 'subscription approved'"),
[10806]76        source = PAID,
[10812]77        destination = CLEARED),
[10806]78    )
79
80
81registration_workflow = KofaWorkflow(REGISTRATION_TRANSITIONS)
82
83class CustomRegistrationWorkflowInfo(RegistrationWorkflowInfo):
84    """Adapter to adapt Student objects to workflow info objects.
85    """
86
87    def __init__(self, context):
88        self.context = context
89        self.wf = registration_workflow
Note: See TracBrowser for help on using the repository browser.