Ignore:
Timestamp:
4 Feb 2019, 12:15:59 (6 years ago)
Author:
Henrik Bettermann
Message:

Customize samePaymentMade.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py

    r15318 r15320  
    189189                    installments += ticket.amount_auth
    190190        return installments
     191
     192    def samePaymentMade(self, student, category, p_item, p_session):
     193        if category == 'bed_allocation':
     194            return False
     195        for key in student['payments'].keys():
     196            ticket = student['payments'][key]
     197            if ticket.p_state == 'paid' and\
     198               ticket.p_category == category and \
     199               ticket.p_item == p_item and \
     200               ticket.p_session == p_session:
     201                  return True
     202        return False
    191203
    192204    def setPaymentDetails(self, category, student,
     
    389401            category = 'hostel_maintenance'
    390402        # Create ticket.
    391         if category != 'bed_allocation' \
    392             and self.samePaymentMade(student, category, p_item, p_session):
     403        if self.samePaymentMade(student, category, p_item, p_session):
    393404            return _('This type of payment has already been made.'), None
    394405        if self._isPaymentDisabled(p_session, category, student):
Note: See TracChangeset for help on using the changeset viewer.