Ignore:
Timestamp:
9 Nov 2015, 11:53:23 (9 years ago)
Author:
Henrik Bettermann
Message:

Fetch hostel maintenance fee from hostel object.

Location:
main/waeup.aaue/trunk/src/waeup/aaue/students
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py

    r13416 r13418  
    309309        self.browser.getControl(name="form.password").value = 'spwd'
    310310        self.browser.getControl("Login").click()
     311        # Test school fee payments
    311312        self.browser.open(self.student_path + '/payments')
    312313        self.browser.getLink("Add current session payment ticket").click()
     
    325326        open(path, 'wb').write(self.browser.contents)
    326327        print "Sample PDF payment_slip.pdf written to %s" % path
     328        # Test hostel maintenance payments
     329        self.browser.open(self.student_path + '/payments')
     330        self.browser.getLink("Add current session payment ticket").click()
     331        self.browser.getControl(name="form.p_category").value = ['hostel_maintenance']
     332        self.browser.getControl("Create ticket").click()
     333        self.assertTrue('ticket created' in self.browser.contents)
     334        ctrl = self.browser.getControl(name='val_id')
     335        value = ctrl.options[1]
     336        self.browser.getLink(value).click()
     337        self.assertTrue('<span>My bed coordinates</span>' in self.browser.contents)
     338        self.assertEqual(self.student['payments'][value].amount_auth, 876.0)
    327339        return
    328340
  • main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py

    r13417 r13418  
    119119            amount = academic_session.booking_fee
    120120        elif category == 'hostel_maintenance':
    121             amount = academic_session.maint_fee
     121            amount = 0.0
     122            bedticket = student['accommodation'].get(
     123                str(student.current_session), None)
     124            if bedticket:
     125                p_item = bedticket.bed_coordinates
     126                if bedticket.bed.__parent__.maint_fee > 0:
     127                    amount = bedticket.bed.__parent__.maint_fee
     128                else:
     129                    # fallback
     130                    amount = academic_session.maint_fee
     131            else:
     132                # Should not happen because this is already checked
     133                # in the browser module, but anyway ...
     134                portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
     135                p_item = trans(_('no bed allocated'), portal_language)
    122136        elif category == 'welfare':
    123137            amount = academic_session.welfare_fee
Note: See TracChangeset for help on using the changeset viewer.