Ignore:
Timestamp:
7 Jun 2019, 10:38:18 (6 years ago)
Author:
Henrik Bettermann
Message:

Customize SchoolFeePaymentsOverviewExporter?.

File:
1 edited

Legend:

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

    r15414 r15452  
    2424from waeup.kofa.interfaces import IKofaUtils
    2525from waeup.kofa.students.export import (get_levels,
    26     DataForLecturerExporter, StudentExporterBase,)
     26    DataForLecturerExporter, StudentExporterBase,
     27    SchoolFeePaymentsOverviewExporter, StudentExporter)
    2728from waeup.aaue.students.interfaces import (
    2829    ICustomStudent, ICustomStudentStudyCourse,
     
    180181            value, name, context=context)
    181182
     183class CustomSchoolFeePaymentsOverviewExporter(SchoolFeePaymentsOverviewExporter):
     184    """
     185    """
     186
     187    def mangle_value(self, value, name, context=None):
     188        """
     189        """
     190        if name in self.year_range_tuple and context is not None:
     191            value = 0
     192            for ticket in context['payments'].values():
     193                if ticket.p_category in (
     194                    'schoolfee',
     195                    'schoolfee_1',
     196                    'schoolfee_2',
     197                    'schoolfee_incl',) and \
     198                    ticket.p_session == int(name):
     199                    if ticket.p_state == 'waived':
     200                        value = 'waived'
     201                        break
     202                    if ticket.p_state == 'paid':
     203                        try:
     204                            value += ticket.amount_auth
     205                        except TypeError:
     206                            pass
     207            if value == 0:
     208                value = ''
     209            elif isinstance(value, float):
     210                value = round(value, 2)
     211        return super(
     212            StudentExporter, self).mangle_value(
     213            value, name, context=context)
Note: See TracChangeset for help on using the changeset viewer.