98 | | |
99 | | * Developers will have to configure the workflows |
100 | | * All configuration will be placed in private/template/<module-name>/default |
101 | | * The configuration pattern is going to be very easy to define a configuration pattern first one need to import S3WorkflowNode class |
102 | | * Each node will be defined something like N("status name").handle(next_status = "next status name", controller = "org", function = "organization", args = "create") |
103 | | * Here {{{.handle(next_status = "status name",args = "create", controller = "org", function = "organization")}}} will contain the action that will update the current node's status to the next sataus i.e only after clicking on this particular action user will be able to achieve the next node. |
104 | | * All option that handle can take for now are - |
105 | | * '''status''' - current status of the node |
106 | | * '''controller''' - controller |
107 | | * '''function''' - function |
108 | | * '''args''' - node action args |
109 | | * '''http''' - http method for the action |
110 | | * '''next_status''' - next status that the node should achieve |
111 | | * And full workflow can be defined like |
112 | | {{{ |
113 | | class S3WorkflowConfig(object): |
114 | | |
115 | | def orgmanagement(self): |
116 | | N = S3Workflow |
117 | | Exit = S3WorkflowExitNode |
118 | | s3db = current.s3db |
119 | | |
120 | | return N("new").handle(controller = "org", |
121 | | function = "organisation", |
122 | | args = "create", |
123 | | next_status = "add organisation get", |
124 | | http = "GET") & \ |
125 | | N("add organisation get").handle(controller = "org", |
126 | | function = "organisation", |
127 | | args = "create", |
128 | | next_status = "add organisation post", |
129 | | http = "POST") & \ |
130 | | N("add organisation post").handle(controller = "org", |
131 | | function = "office", |
132 | | args = [1,"update"], |
133 | | next_status = "add office")\ |
134 | | .handle(controller = "org", |
135 | | function = "facility", |
136 | | next_status = "add facility", |
137 | | postp = postp) & \ |
138 | | ( N("add office").handle(controller = "hrm", |
139 | | function = "staff", |
140 | | args = "create", |
141 | | next_status = "add staff") | \ |
142 | | N("add facility").handle(controller = "hrm", |
143 | | function = "staff", |
144 | | args = "create", |
145 | | next_status = "add staff") ) & \ |
146 | | Exit() |
147 | | |
148 | | |
149 | | |
150 | | |
151 | | |
152 | | }}} |
153 | | |
154 | | * Here ‘&’ depict that the next node is a necessary or required node and ‘|’ depict that next node is a optional or a choice node. |
155 | | * Exit(..) tells the workflow engine to end workflow here |
156 | | * Developer will be free to configure prep and postp for each node. |
157 | | * this will be added something like this - |
158 | | {{{ |
159 | | |
160 | | N().handle(status = "create incident", prep, postp) |
161 | | }}} |
| 98 | |
| 99 | Here's a tutorial on how to create workflow in Sahana Eden [[wiki:DeveloperGuidelines/s3workflow| Workflow tutorial ]] |