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

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

Configure meter charge payment.

Customize workflow.

  • Property svn:keywords set to Id
File size: 2.3 KB
Line 
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',
29        title = _('Approve contract'),
30        msg = _('Contract approved'),
31        source = CREATED,
32        destination = ADMITTED),
33
34    Transition(
35        transition_id = 'reset1',
36        title = _('Reset customer to initial state'),
37        msg = _('Reset to initial state'),
38        source = ADMITTED,
39        destination = CREATED),
40
41    Transition(
42        transition_id = 'pay_meter_fee',
43        title = _('Pay meter fee'),
44        msg = _('Meter fee paid'),
45        source = ADMITTED,
46        destination = PAID),
47
48    Transition(
49        transition_id = 'approve_meter_fee_payment',
50        title = _('Approve meter fee payment'),
51        msg = _('Meter fee payment approved'),
52        source = ADMITTED,
53        destination = PAID),
54
55    Transition(
56        transition_id = 'reset2',
57        title = _("Reset customer to state 'contract approved'"),
58        msg = _("Reset to state 'contract approved'"),
59        source = PAID,
60        destination = ADMITTED),
61    )
62
63
64registration_workflow = KofaWorkflow(REGISTRATION_TRANSITIONS)
65
66class CustomRegistrationWorkflowInfo(RegistrationWorkflowInfo):
67    """Adapter to adapt Student objects to workflow info objects.
68    """
69
70    def __init__(self, context):
71        self.context = context
72        self.wf = registration_workflow
Note: See TracBrowser for help on using the repository browser.