Changeset 12352


Ignore:
Timestamp:
31 Dec 2014, 13:38:50 (10 years ago)
Author:
Henrik Bettermann
Message:

Customers must have been approved before verifying documents or approving contracts.

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba/customers
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/contracts.py

    r12346 r12352  
    149149    @property
    150150    def is_approvable(self):
     151        if self.customer and not self.customer.state in getUtility(
     152                ICustomersUtils).CONMANAGE_CUSTOMER_STATES:
     153            return False, _("Customer has not yet been approved.")
    151154        for key, field in getFields(self.check_docs_interface).items():
    152155            if key.endswith('_object'):
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/documents.py

    r12256 r12352  
    166166    @property
    167167    def is_verifiable(self):
     168        if self.customer and not self.customer.state in getUtility(
     169                ICustomersUtils).CONMANAGE_CUSTOMER_STATES:
     170            return False, _("Customer has not yet been approved.")
    168171        files = self.connected_files
    169172        if files is not None and len(files) != len(self.filenames):
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py

    r12351 r12352  
    837837        # Managers can access the pages of customer documentsconter
    838838        # and can perform actions
     839        IWorkflowState(self.customer).setState('approved')
    839840        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    840841        self.browser.open(self.customer_path)
     
    10411042
    10421043    def test_verify_document(self):
     1044        IWorkflowState(self.customer).setState('approved')
    10431045        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    10441046        self.browser.open(self.customer_path + '/documents/DOC1/manage')
     
    13471349
    13481350    def test_contract_approval(self):
    1349         # This is not a UI test. It just a functional test.
     1351        # This is not a UI test. It's just a functional test.
    13501352        self.assertRaises(ConstraintNotSatisfied,
    13511353            self.contract.document_object, self.document)
     
    13561358        self.assertRaises(InvalidTransitionError,
    13571359            IWorkflowInfo(self.contract).fireTransition, 'approve')
    1358         # Document must be verified for the approval of contracts
     1360        # Customer must be approved and
     1361        # document must be verified for the approval of contracts
    13591362        IWorkflowState(self.document).setState('verified')
     1363        IWorkflowState(self.customer).setState('approved')
    13601364        IWorkflowInfo(self.contract).fireTransition('approve')
    13611365        self.assertEqual(IWorkflowState(self.contract).getState(), 'approved')
    13621366
    13631367    def test_contract_approval_in_UI(self):
    1364         # Now let's see what the UI says why trying to approve a contract
     1368        # Now let's see what the UI says when trying to approve a contract
    13651369        # with unverified documents.
     1370        IWorkflowState(self.customer).setState('approved')
    13661371        IWorkflowState(self.document).setState('submitted')
    13671372        self.contract.document_object = self.document
Note: See TracChangeset for help on using the changeset viewer.