Changeset 12151
- Timestamp:
- 5 Dec 2014, 15:43:24 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba/customers
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser.py
r12119 r12151 31 31 from zope.formlib.textwidgets import BytesDisplayWidget 32 32 from zope.security import checkPermission 33 from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState 33 from hurry.workflow.interfaces import ( 34 IWorkflowInfo, IWorkflowState, InvalidTransitionError) 34 35 from waeup.ikoba.interfaces import MessageFactory as _ 35 36 from waeup.ikoba.interfaces import ( … … 1255 1256 transition_id = form['transition'] 1256 1257 wf_info = IWorkflowInfo(self.context) 1257 wf_info.fireTransition(transition_id) 1258 try: 1259 wf_info.fireTransition(transition_id) 1260 except InvalidTransitionError, error: 1261 self.flash(error, type="warning") 1258 1262 return 1259 1263 -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py
r12145 r12151 1226 1226 IWorkflowInfo(self.contract).fireTransition('approve') 1227 1227 self.assertEqual(IWorkflowState(self.contract).getState(), 'approved') 1228 return 1229 1228 1229 1230 def test_contract_approval_in_UI(self): 1231 # Now let's see what the UI says why trying to approve a contract 1232 # with unverified documents. 1233 IWorkflowState(self.document).setState('submitted') 1234 self.contract.document_object = self.document 1235 IWorkflowState(self.contract).setState('submitted') 1236 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 1237 self.browser.open(self.contracts_path + '/c101/trigtrans') 1238 self.browser.getControl(name="transition").value = ['approve'] 1239 self.browser.getControl("Save").click() 1240 # InvalidTransitionError is catched 1241 self.assertTrue( 1242 '<div class="alert alert-warning">Attached documents must be verified first.</div>' 1243 in self.browser.contents) 1244 IWorkflowState(self.document).setState('verified') 1245 self.browser.getControl(name="transition").value = ['approve'] 1246 self.browser.getControl("Save").click() 1247 self.assertEqual(IWorkflowState(self.contract).getState(), 'approved') -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/workflow.py
r12145 r12151 252 252 IWorkflowState(obj).setState(event.transition.source) 253 253 raise InvalidTransitionError( 254 "Documents must be verified first.")254 _("Attached documents must be verified first.")) 255 255 msg = event.transition.user_data['msg'] 256 256 history = IObjectHistory(obj)
Note: See TracChangeset for help on using the changeset viewer.