Changeset 8775


Ignore:
Timestamp:
22 Jun 2012, 16:40:39 (12 years ago)
Author:
Henrik Bettermann
Message:

Fix flow of payments.

Location:
main/waeup.aaue/trunk/src/waeup/aaue/students
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py

    r8753 r8775  
    261261        self.assertMatches('...ticket created...',
    262262                           self.browser.contents)
    263         # In state returning we can't add a new school fee ticket
    264         # for the next session because the second instalment is missing ...
    265         IWorkflowState(self.student).setState('returning')
    266         self.browser.open(self.payments_path + '/addop')
    267         self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
    268         self.browser.getControl("Create ticket").click()
    269         self.assertMatches('...2nd school fee instalment has not yet been paid...',
    270                            self.browser.contents)
     263        # We can't add the 2nd instalment ticket because the
     264        # first one has not yet been approved.
    271265        self.browser.open(self.payments_path + '/addop')
    272266        self.browser.getControl(name="form.p_category").value = ['schoolfee_2']
    273         # ... and the first one has not yet been approved.
    274267        self.browser.getControl("Create ticket").click()
    275268        self.assertMatches('...1st school fee instalment has not yet been paid...',
     
    289282        p_id = ctrl.options[1]
    290283        self.browser.open(self.payments_path + '/' + p_id + '/approve')
    291         # ... and finally add the 1st instalment for the next session.
     284        # ... and finally add the 1st instalment for the next session
     285        # provided that student is returning.
     286        IWorkflowState(self.student).setState('returning')
    292287        self.browser.open(self.payments_path + '/addop')
    293288        self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
  • main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py

    r8769 r8775  
    9595                for key in student['payments'].keys():
    9696                    ticket = student['payments'][key]
    97                     if ticket.p_category == 'schoolfee_1':
     97                    if ticket.p_category == 'schoolfee_1' and \
     98                        ticket.p_state == 'paid':
    9899                        initial_instalment_made = True
    99100                    if ticket.p_state == 'paid' and\
    100                        ticket.p_category == 'schoolfee_2' and \
    101                        ticket.p_item == p_item and \
    102                        ticket.p_session == p_session-1: #  = current session
    103                        payment_allowed = True
     101                        ticket.p_category == 'schoolfee_2' and \
     102                        ticket.p_item == p_item and \
     103                        ticket.p_session == p_session-1: #  = current session
     104                        payment_allowed = True
    104105                if not initial_instalment_made:
    105106                    payment_allowed = True
     
    126127            if not payment_allowed:
    127128                return _('The 1st school fee instalment '
    128                          'has not yet been paid.'), None
     129                         'has not yet been paid or session has '
     130                         'not yet been started.'), None
    129131            amount = academic_session.school_fee_base
    130132        if amount in (0.0, None):
Note: See TracChangeset for help on using the changeset viewer.