Changeset 12028 for main/waeup.ikoba/trunk
- Timestamp:
- 21 Nov 2014, 13:05:56 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba/customers
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser.py
r12018 r12028 378 378 379 379 class CustomerTriggerTransitionFormPage(IkobaEditFormPage): 380 """ View to manage customer base data380 """ View to trigger customer workflow transitions 381 381 """ 382 382 grok.context(ICustomer) … … 793 793 return 794 794 795 795 796 class DocumentEditFormPage(DocumentManageFormPage): 796 797 """ Page to edit a document 797 798 """ 798 grok.context(ICustomerDocument)799 799 grok.name('edit') 800 800 grok.require('waeup.handleCustomer') 801 form_fields = grok.AutoFields(ICustomerDocument)802 pnav = 4803 801 804 802 def update(self): … … 807 805 return 808 806 return super(DocumentEditFormPage, self).update() 807 808 809 class DocumentTriggerTransitionFormPage(IkobaEditFormPage): 810 """ View to trigger customer document transitions 811 """ 812 grok.context(ICustomerDocument) 813 grok.name('trigtrans') 814 grok.require('waeup.triggerTransition') 815 grok.template('trigtrans') 816 label = _('Trigger document transition') 817 pnav = 4 818 819 def update(self): 820 return super(IkobaEditFormPage, self).update() 821 822 def getTransitions(self): 823 """Return a list of dicts of allowed transition ids and titles. 824 825 Each list entry provides keys ``name`` and ``title`` for 826 internal name and (human readable) title of a single 827 transition. 828 """ 829 wf_info = IWorkflowInfo(self.context) 830 allowed_transitions = [t for t in wf_info.getManualTransitions()] 831 return [dict(name='', title=_('No transition'))] +[ 832 dict(name=x, title=y) for x, y in allowed_transitions] 833 834 @action(_('Save'), style='primary') 835 def save(self, **data): 836 form = self.request.form 837 if 'transition' in form and form['transition']: 838 transition_id = form['transition'] 839 wf_info = IWorkflowInfo(self.context) 840 wf_info.fireTransition(transition_id) 841 return -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser_templates/trigtrans.pt
r11967 r12028 3 3 autocomplete="off"> 4 4 5 <br /> 5 6 6 7 <select id="transition" name="transition" class="form-control half"> -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py
r12020 r12028 294 294 self.assertEqual(self.browser.headers['Status'], '200 Ok') 295 295 self.assertEqual(self.browser.url, self.customer_path) 296 self.browser.getLink("Tr igger").click()296 self.browser.getLink("Transition").click() 297 297 self.assertEqual(self.browser.headers['Status'], '200 Ok') 298 298 # Managers can trigger transitions … … 800 800 self.assertEqual(self.browser.url, self.documents_path + '/d102/index') 801 801 802 # Transitions can be performed 803 self.browser.getLink("Transition").click() 804 self.browser.getControl(name="transition").value = ['submit'] 805 self.browser.getControl("Save").click() 806 self.browser.getControl(name="transition").value = ['verify'] 807 self.browser.getControl("Save").click() 808 self.assertEqual(document.state, 'verified') 809 802 810 # Documents can be removed 803 811 self.browser.getLink("Documents").click() -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/viewlets.py
r12018 r12028 202 202 grok.require('waeup.triggerTransition') 203 203 icon = 'actionicon_trigtrans.png' 204 text = _(u'Tr igger transition')204 text = _(u'Transition') 205 205 target = 'trigtrans' 206 206 … … 323 323 324 324 325 class DocumentTrigTransActionButton(ManageActionButton): 326 grok.order(2) 327 grok.context(ICustomerDocument) 328 grok.view(DocumentDisplayFormPage) 329 grok.require('waeup.triggerTransition') 330 icon = 'actionicon_trigtrans.png' 331 text = _(u'Transition') 332 target = 'trigtrans' 333 334 325 335 class DocumentViewActionButton(ManageActionButton): 326 336 grok.order(1)
Note: See TracChangeset for help on using the changeset viewer.