Ignore:
Timestamp:
10 Jan 2016, 22:18:06 (9 years ago)
Author:
Henrik Bettermann
Message:

Implement first draft of bursary clearance slip.

File:
1 edited

Legend:

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

    r9993 r13583  
    2020"""
    2121import grok
     22from datetime import datetime
     23from zope.component import getUtility
    2224from zope.component.interfaces import IFactory
    2325from zope.interface import implementedBy
     26from waeup.kofa.interfaces import IKofaUtils
    2427from waeup.kofa.students.interfaces import IStudentNavigation
    2528from waeup.kofa.students.payments import (
    2629    StudentOnlinePayment, StudentOnlinePaymentFactory)
    27 from waeup.kofa.utils.helpers import attrs_to_fields
     30from waeup.kofa.utils.helpers import attrs_to_fields, to_timezone
    2831from waeup.uniben.students.interfaces import ICustomStudentOnlinePayment
    2932
     
    4750        return self.__parent__.__parent__
    4851
     52    @property
     53    def formatted_p_date(self):
     54        if isinstance(self.payment_date, datetime):
     55            tz = getUtility(IKofaUtils).tzinfo
     56            try:
     57                timestamp = to_timezone(
     58                    self.payment_date, tz).strftime("%Y-%m-%d %H:%M:%S")
     59            except ValueError:
     60                return None
     61            return timestamp
     62        else:
     63            return None
     64
    4965CustomStudentOnlinePayment = attrs_to_fields(
    5066    CustomStudentOnlinePayment, omit=['display_item'])
Note: See TracChangeset for help on using the changeset viewer.