Index: main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py
===================================================================
--- main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py	(revision 8771)
+++ main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py	(revision 8775)
@@ -261,15 +261,8 @@
         self.assertMatches('...ticket created...',
                            self.browser.contents)
-        # In state returning we can't add a new school fee ticket 
-        # for the next session because the second instalment is missing ...
-        IWorkflowState(self.student).setState('returning')
-        self.browser.open(self.payments_path + '/addop')
-        self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
-        self.browser.getControl("Create ticket").click()
-        self.assertMatches('...2nd school fee instalment has not yet been paid...',
-                           self.browser.contents)
+        # We can't add the 2nd instalment ticket because the
+        # first one has not yet been approved.
         self.browser.open(self.payments_path + '/addop')
         self.browser.getControl(name="form.p_category").value = ['schoolfee_2']
-        # ... and the first one has not yet been approved.
         self.browser.getControl("Create ticket").click()
         self.assertMatches('...1st school fee instalment has not yet been paid...',
@@ -289,5 +282,7 @@
         p_id = ctrl.options[1]
         self.browser.open(self.payments_path + '/' + p_id + '/approve')
-        # ... and finally add the 1st instalment for the next session.
+        # ... and finally add the 1st instalment for the next session
+        # provided that student is returning.
+        IWorkflowState(self.student).setState('returning')
         self.browser.open(self.payments_path + '/addop')
         self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
Index: main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py
===================================================================
--- main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py	(revision 8771)
+++ main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py	(revision 8775)
@@ -95,11 +95,12 @@
                 for key in student['payments'].keys():
                     ticket = student['payments'][key]
-                    if ticket.p_category == 'schoolfee_1':
+                    if ticket.p_category == 'schoolfee_1' and \
+                        ticket.p_state == 'paid':
                         initial_instalment_made = True
                     if ticket.p_state == 'paid' and\
-                       ticket.p_category == 'schoolfee_2' and \
-                       ticket.p_item == p_item and \
-                       ticket.p_session == p_session-1: #  = current session
-                       payment_allowed = True
+                        ticket.p_category == 'schoolfee_2' and \
+                        ticket.p_item == p_item and \
+                        ticket.p_session == p_session-1: #  = current session
+                        payment_allowed = True
                 if not initial_instalment_made:
                     payment_allowed = True
@@ -126,5 +127,6 @@
             if not payment_allowed:
                 return _('The 1st school fee instalment '
-                         'has not yet been paid.'), None
+                         'has not yet been paid or session has '
+                         'not yet been started.'), None
             amount = academic_session.school_fee_base
         if amount in (0.0, None):
