Changeset 16087 for main


Ignore:
Timestamp:
6 May 2020, 13:49:45 (5 years ago)
Author:
Henrik Bettermann
Message:

Add base data slip download button.

Location:
main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students
Files:
2 edited

Legend:

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

    r15859 r16087  
    122122        IWorkflowInfo(self.student).fireTransition('pay_school_fee')
    123123        self.assertFalse(self.student.library)
     124
     125    def test_student_basedata_slip(self):
     126        IWorkflowState(self.student).setState('school fee paid')
     127        self.browser.open(self.login_path)
     128        self.browser.getControl(name="form.login").value = self.student_id
     129        self.browser.getControl(name="form.password").value = 'spwd'
     130        self.browser.getControl("Login").click()
     131        # Students can open base data slip
     132        # (no button available in base package)
     133        pdf_url = '%s/basedata_slip.pdf' % self.studycourse_path
     134        self.browser.open(pdf_url)
     135        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     136        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
     137        path = os.path.join(samples_dir(), 'basedata_slip.pdf')
     138        open(path, 'wb').write(self.browser.contents)
     139        print "Sample PDF basedata_slip.pdf written to %s" % path
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/viewlets.py

    r16031 r16087  
    2323from waeup.kofa.students.interfaces import IStudent, IStudentsUtils
    2424from kofacustom.iuokada.students.interfaces import (
    25     ICustomStudentStudyCourse, ICustomStudentStudyLevel, ICustomStudent)
     25    ICustomStudentStudyCourse, ICustomStudentStudyLevel, ICustomStudent,
     26    ICustomStudentStudyCourse)
    2627from waeup.kofa.students.fileviewlets import (
    2728    StudentFileDisplay, StudentFileUpload, StudentImage)
     
    4243    target = 'switch_library_access'
    4344    icon = 'actionicon_book.png'
     45
     46class BaseDataSlipActionButton(ManageActionButton):
     47    grok.order(10)
     48    grok.context(ICustomStudentStudyCourse)
     49    grok.view(StudyCourseDisplayFormPage)
     50    grok.require('waeup.viewStudent')
     51    text = _('Download base data slip')
     52    target = 'basedata_slip.pdf'
     53    icon = 'actionicon_pdf.png'
    4454
    4555class AddBalancePaymentActionButton(AddBalancePaymentActionButton):
Note: See TracChangeset for help on using the changeset viewer.