Index: main/waeup.aaua/trunk/src/waeup/aaua/students/tests/test_browser.py
===================================================================
--- main/waeup.aaua/trunk/src/waeup/aaua/students/tests/test_browser.py	(revision 10180)
+++ main/waeup.aaua/trunk/src/waeup/aaua/students/tests/test_browser.py	(revision 10181)
@@ -157,9 +157,13 @@
         error, payment = utils.setPaymentDetails('schoolfee_1',self.student)
         self.assertEqual(payment.amount_auth, 80.0)
-        error, payment = utils.setPaymentDetails('schoolfee_2',self.student)
-        self.assertEqual(payment.amount_auth, 120.0)
         IWorkflowState(self.student).setState('cleared')
         error, payment = utils.setPaymentDetails('schoolfee_1',self.student)
         self.assertEqual(payment.amount_auth, 40.0)
+
+        # schoolfee_2 payment is state-independent
+        self.student['studycourse'].entry_session = 2003
+        error, payment = utils.setPaymentDetails('schoolfee_2',self.student)
+        self.assertEqual(payment.amount_auth, 120.0)
+        self.student['studycourse'].entry_session = 2004
         error, payment = utils.setPaymentDetails('schoolfee_2',self.student)
         self.assertEqual(payment.amount_auth, 60.0)
Index: main/waeup.aaua/trunk/src/waeup/aaua/students/utils.py
===================================================================
--- main/waeup.aaua/trunk/src/waeup/aaua/students/utils.py	(revision 10180)
+++ main/waeup.aaua/trunk/src/waeup/aaua/students/utils.py	(revision 10181)
@@ -50,16 +50,16 @@
             return _(u'Session configuration object is not available.'), None
         # Determine fee.
-        if category in ('schoolfee', 'schoolfee_1',  'schoolfee_2'):
-            try:
-                certificate = student['studycourse'].certificate
-                p_item = certificate.code
-            except (AttributeError, TypeError):
-                return _('Study course data are incomplete.'), None
-            ratio = getattr(certificate, 'ratio', 0.0)
-            if ratio is None:
-                ratio = 0.0
+        try:
+            certificate = student['studycourse'].certificate
+            p_item = certificate.code
+        except (AttributeError, TypeError):
+            return _('Study course data are incomplete.'), None
+        ratio = getattr(certificate, 'ratio', 0.0)
+        if ratio is None:
+            ratio = 0.0
+        if category in ('schoolfee', 'schoolfee_1'):
             if category == 'schoolfee' and ratio > 0:
                 return _('Payment by instalments required.'), None
-            if category in ('schoolfee_1',  'schoolfee_2') and ratio == 0:
+            if category =='schoolfee_1' and ratio == 0:
                 return _('Payment by instalments not allowed.'), None
             if student.state == CLEARED:
@@ -68,6 +68,4 @@
                 elif category == 'schoolfee_1':
                     amount = getattr(certificate, 'school_fee_1', 0.0) * ratio
-                elif category == 'schoolfee_2':
-                    amount = getattr(certificate, 'school_fee_1', 0.0) * (1- ratio)
             elif student.state == RETURNING:
                 # In case of returning school fee payment the
@@ -87,6 +85,4 @@
                     if student['studycourse'].entry_session in (2005, 2006, 2007):
                         amount -= 20000.0
-                elif category == 'schoolfee_2' and ratio:
-                    amount = getattr(certificate, 'school_fee_2', 0.0) * (1- ratio)
             elif student.is_postgrad and student.state == PAID:
                 # Returning postgraduate students also pay for the
@@ -103,6 +99,11 @@
                 elif category == 'schoolfee_1':
                     amount = getattr(certificate, 'school_fee_2', 0.0) * ratio
-                elif category == 'schoolfee_2' and ratio:
-                    amount = getattr(certificate, 'school_fee_2', 0.0) * (1- ratio)
+        elif category ==  'schoolfee_2':
+            if ratio == 0:
+                return _('Payment by instalments not allowed.'), None
+            if student['studycourse'].entry_session == student.current_session:
+                amount = getattr(certificate, 'school_fee_1', 0.0) * (1- ratio)
+            else:
+                amount = getattr(certificate, 'school_fee_2', 0.0) * (1- ratio)
         if amount in (0.0, None):
             return _('Amount could not be determined.'), None
