Changeset 12034 for main/waeup.ikoba


Ignore:
Timestamp:
22 Nov 2014, 07:23:05 (10 years ago)
Author:
Henrik Bettermann
Message:

Add 'final submit' action.

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

    r12028 r12034  
    5252
    5353grok.context(IIkobaObject)
     54
     55WARNING = _('You can not edit your document after final submission.'
     56            ' You really want to submit?')
    5457
    5558
     
    806809        return super(DocumentEditFormPage, self).update()
    807810
     811    @action(_('Save'), style='primary')
     812    def save(self, **data):
     813        msave(self, **data)
     814        return
     815
     816    @action(_('Final Submit'), warning=WARNING)
     817    def finalsubmit(self, **data):
     818        msave(self, **data)
     819        IWorkflowInfo(self.context).fireTransition('submit')
     820        self.flash(_('Form has been submitted.'))
     821        self.redirect(self.url(self.context))
     822        return
     823
    808824
    809825class DocumentTriggerTransitionFormPage(IkobaEditFormPage):
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser_templates/documentpage.pt

    r12033 r12034  
    11<div class="wfstatus-sub"  i18n:domain="waeup.kofa">
    2   Document State:
    3   <span tal:replace="context/translated_state">
    4     VERIFICATIONSTATE
    5   </span>
     2  Document State: <span tal:replace="context/translated_state">
     3    VERIFICATIONSTATE</span>
    64</div>
    75
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py

    r12028 r12034  
    860860        self.browser.getControl(name="form.title").value = 'My second doc'
    861861        self.browser.getControl("Save").click()
     862        self.assertEqual(document.title, 'My second doc')
    862863        self.assertTrue('Form has been saved.' in self.browser.contents)
    863864        self.browser.getLink("View").click()
    864865        self.assertEqual(self.browser.url, self.documents_path + '/d102/index')
    865         # Customer can't edit the document once it has been verified
    866         IWorkflowState(document).setState(VERIFIED)
     866        # Costumer can submit the form. The form is also saved.
     867        self.browser.getLink("Edit").click()
     868        self.browser.getControl(name="form.title").value = 'My third doc'
     869        self.browser.getControl("Final Submit").click()
     870        self.assertEqual(document.title, 'My third doc')
     871        self.assertEqual(document.state, 'submitted')
     872        self.assertTrue('Document State: submitted for verification' in self.browser.contents)
     873        # Customer can't edit the document once it has been submitted
    867874        self.browser.open(self.documents_path + '/d102/edit')
    868875        self.assertTrue('The requested form is locked' in self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.