Ignore:
Timestamp:
13 Oct 2015, 17:29:07 (9 years ago)
Author:
Henrik Bettermann
Message:

Add maint_payment_made method to BedTicket? class.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/accommodation.py

    r9987 r13314  
    8181        return students_utils.getBedCoordinates(self)
    8282
     83    @property
     84    def maint_payment_made(self):
     85        try:
     86            if len(self.student['payments']):
     87                for ticket in self.student['payments'].values():
     88                    if ticket.p_category == 'hostel_maintenance' and \
     89                        ticket.p_session == self.booking_session and \
     90                        ticket.p_state == 'paid':
     91                            return True
     92        except TypeError: # in unit tests
     93            pass
     94        return False
     95
    8396    def writeLogMessage(self, view, message):
    8497        return self.__parent__.__parent__.writeLogMessage(view, message)
  • main/waeup.kofa/trunk/src/waeup/kofa/students/export.py

    r13281 r13314  
    445445        sorted(iface_names(
    446446            IBedTicket, exclude_attribs=False,
    447             omit=['display_coordinates']))) + (
     447            omit=['display_coordinates', 'maint_payment_made']))) + (
    448448            'student_id', 'actual_bed_type')
    449449    title = _(u'Bed Tickets')
  • main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py

    r13167 r13314  
    705705    """A representation of accommodation booking data.
    706706    """
    707     bed = Attribute('The bed object.')
     707    bed = Attribute('The bed object')
    708708    booking_date = Attribute('Date of booking the bed')
     709    maint_payment_made = Attribute('True if maintenance payment is made')
    709710
    710711    display_coordinates = schema.TextLine(
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r13241 r13314  
    30903090        value = ctrl.options[1]
    30913091        self.assertEqual(self.student['payments'][value].amount_auth, 987.0)
     3092        # The bedticket is aware of successfull maintenance fee payment
     3093        bedticket = self.student['accommodation']['2004']
     3094        self.assertFalse(bedticket.maint_payment_made)
     3095        self.student['payments'][value].approve()
     3096        self.assertTrue(bedticket.maint_payment_made)
    30923097        return
    30933098
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_student.py

    r13002 r13314  
    140140        return
    141141
     142    def test_maint_payment_made(self):
     143        self.assertFalse(self.bedticket.maint_payment_made)
     144        return
     145
     146
    142147class StudentRemovalTests(StudentImportExportSetup):
    143148    # Test handle_student_removed
Note: See TracChangeset for help on using the changeset viewer.