Ignore:
Timestamp:
6 Mar 2021, 12:02:24 (4 years ago)
Author:
Henrik Bettermann
Message:

Change requirement to access edit_personal.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/student.py

    r16306 r16408  
    5151        return False
    5252
    53     def minimumStudentPayments(self, minamount):
     53    def minimumStudentPayments_not_used(self, minamount):
    5454        """Need to access edit_personal. Only in iuokada package.
    5555        """
     
    6363                and ticket.p_session >= self.current_session:
    6464                total_amount += ticket.amount_auth
     65        if total_amount >= minamount:
     66            return True
     67        return False
     68
     69    def minimumStudentPayments(self, minamount):
     70        """Need to access edit_personal. Only in iuokada package.
     71        """
     72        if self.sponsor in ['bauchi', 'federalgov', 'kano']:
     73            return True
     74        try:
     75            certificate = self['studycourse'].certificate
     76        except (AttributeError, TypeError):
     77            return _('Study course data are incomplete.'), None
     78        total_amount = 0.0
     79        for ticket in self['payments'].values():
     80            if ticket.p_state == 'paid' \
     81                and ticket.p_session >= self.current_session \
     82                and ticket.p_category in ('schoolfee', 'schoolfee40', 'secondinstal'):
     83                total_amount += ticket.amount_auth
     84        if self.is_fresh:
     85            minamount = 0.4 * getattr(certificate, 'school_fee_1', 0.0)
     86        else:
     87            minamount = 0.4 * getattr(certificate, 'school_fee_2', 0.0)
    6588        if total_amount >= minamount:
    6689            return True
Note: See TracChangeset for help on using the changeset viewer.