Changeset 8961


Ignore:
Timestamp:
9 Jul 2012, 14:41:08 (12 years ago)
Author:
Henrik Bettermann
Message:

Returning students and pg students get penalty fee data from next academic_session.

Add pg workflow shortcut.

Location:
main/waeup.aaue/trunk/src/waeup/aaue
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue

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

    r8909 r8961  
    177177        self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
    178178        self.browser.getControl("Create ticket").click()
    179         self.assertMatches('...ticket created...',
    180                            self.browser.contents)
    181 
     179        self.assertMatches('...Session configuration object is not...',
     180                           self.browser.contents)
     181        # Uups, we forgot to add a session configuration for next session
     182        configuration = createObject('waeup.SessionConfiguration')
     183        configuration.academic_session = 2005
     184        self.app['configuration'].addSessionConfiguration(configuration)
     185        self.app['configuration']['2005'].school_fee_base = 7777.0
     186        self.browser.open(self.payments_path + '/addop')
     187        self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
     188        self.browser.getControl("Create ticket").click()
     189        self.assertMatches('...ticket created...',
     190                           self.browser.contents)
    182191        # If the session configuration doesn't exist an error message will
    183192        # be shown. No other requirement is being checked.
     
    208217        utils = getUtility(IStudentsUtils)
    209218
     219        configuration = createObject('waeup.SessionConfiguration')
     220        configuration.academic_session = 2005
     221        self.app['configuration'].addSessionConfiguration(configuration)
     222        self.app['configuration']['2005'].school_fee_base = 7777.0
     223
    210224        error, payment = utils.setPaymentDetails('schoolfee_1',self.student)
    211225        self.assertEqual(payment, None)
     
    220234        self.assertEqual(error, None)
    221235
    222         # Add penalty fee.
     236        # Add penalty fee ...
     237        # ... for cleared
    223238        self.app['configuration']['2004'].penalty_ug = 99.0
     239        # ... for returning
     240        self.app['configuration']['2005'].penalty_ug = 88.0
    224241        error, payment = utils.setPaymentDetails('schoolfee_1',self.student)
    225242        self.assertEqual(payment.amount_auth, 6765.0)
    226 
    227243        IWorkflowState(self.student).setState('returning')
    228244        error, payment = utils.setPaymentDetails('schoolfee_1',self.student)
    229245        self.assertEqual(payment.p_level, 200)
    230246        self.assertEqual(payment.p_session, 2005)
    231         self.assertEqual(payment.amount_auth, 6765.0)
     247        self.assertEqual(payment.amount_auth, 7865.0)
    232248        self.assertEqual(payment.p_item, u'CERT1')
    233249        self.assertEqual(error, None)
  • main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py

    r8954 r8961  
    8888                payment_allowed = True
    8989                amount = academic_session.school_fee_base
    90             elif student.state == RETURNING:
    91                 p_session, p_level = self.getReturningData(student)
     90            elif student.state == RETURNING or\
     91                (student.is_postgrad and student.state == PAID):
     92                if student.state == RETURNING:
     93                    p_session, p_level = self.getReturningData(student)
     94                else:
     95                    # Returning postgraduate students also pay for the
     96                    # next session but their level always remains the same.
     97                    p_session += 1
    9298                initial_instalment_made = False
    9399                for key in student['payments'].keys():
     
    103109                if not initial_instalment_made:
    104110                    payment_allowed = True
     111                try:
     112                    academic_session = grok.getSite()[
     113                        'configuration'][str(p_session)]
     114                except KeyError:
     115                    return _(u'Session configuration object is not available.'), None
    105116                amount = academic_session.school_fee_base
    106117            else:
Note: See TracChangeset for help on using the changeset viewer.