Index: main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/utils.py
===================================================================
--- main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/utils.py	(revision 15779)
+++ main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/utils.py	(revision 15780)
@@ -95,34 +95,42 @@
                 else:
                     amount = getattr(certificate, 'school_fee_2', 0.0)
+                if category == 'schoolfee40':
+                    amount = 0.4*amount
+                elif category == 'secondinstal':
+                    amount = 0.6*amount
             else:
-                if student.state == CLEARED:
-                    amount = getattr(certificate, 'school_fee_1', 0.0)
-                elif student.state == RETURNING:
-                    # In case of returning school fee payment the
-                    # payment session and level contain the values of
-                    # the session the student has paid for. Payment
-                    # session is always next session.
-                    p_session, p_level = self.getReturningData(student)
-                    academic_session = self._getSessionConfiguration(p_session)
-                    if academic_session == None:
-                        return _(
-                            u'Session configuration object is not available.'
-                            ), None
-                    amount = getattr(certificate, 'school_fee_2', 0.0)
-                elif student.is_postgrad and student.state == PAID:
-                    # Returning postgraduate students also pay for the
-                    # next session but their level always remains the
-                    # same.
-                    p_session += 1
-                    academic_session = self._getSessionConfiguration(p_session)
-                    if academic_session == None:
-                        return _(
-                            u'Session configuration object is not available.'
-                            ), None
-                    amount = getattr(certificate, 'school_fee_2', 0.0)
-                if amount and category == 'schoolfee40':
-                    amount = 0.4*amount
-                elif amount and category == 'secondinstal':
-                    amount = 0.6*amount
+                if category == 'secondinstal':
+                    if student.is_fresh:
+                        amount = 0.6 * getattr(certificate, 'school_fee_1', 0.0)
+                    else:
+                        amount = 0.6 * getattr(certificate, 'school_fee_2', 0.0)
+                else:
+                    if student.state == CLEARED:
+                        amount = getattr(certificate, 'school_fee_1', 0.0)
+                    elif student.state == RETURNING:
+                        # In case of returning school fee payment the
+                        # payment session and level contain the values of
+                        # the session the student has paid for. Payment
+                        # session is always next session.
+                        p_session, p_level = self.getReturningData(student)
+                        academic_session = self._getSessionConfiguration(p_session)
+                        if academic_session == None:
+                            return _(
+                                u'Session configuration object is not available.'
+                                ), None
+                        amount = getattr(certificate, 'school_fee_2', 0.0)
+                    elif student.is_postgrad and student.state == PAID:
+                        # Returning postgraduate students also pay for the
+                        # next session but their level always remains the
+                        # same.
+                        p_session += 1
+                        academic_session = self._getSessionConfiguration(p_session)
+                        if academic_session == None:
+                            return _(
+                                u'Session configuration object is not available.'
+                                ), None
+                        amount = getattr(certificate, 'school_fee_2', 0.0)
+                    if amount and category == 'schoolfee40':
+                        amount = 0.4*amount
         elif category == 'clearance':
             try:
