Ignore:
Timestamp:
19 Mar 2015, 11:27:36 (10 years ago)
Author:
Henrik Bettermann
Message:

Render all payment data (depending on interface) on PDFContractReceiptPage.

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser.py

    r12772 r12793  
    3434    STARTED, VERIFIED, REJECTED, EXPIRED, CREATED, REQUESTED,
    3535    APPROVED, PROVISIONALLY, AWAITING)
     36from waeup.ikoba.widgets.datewidget import (
     37    FriendlyDateWidget, FriendlyDateDisplayWidget,
     38    FriendlyDatetimeDisplayWidget)
    3639from waeup.ikoba.browser.layout import (
    3740    IkobaPage, IkobaEditFormPage, IkobaAddFormPage, IkobaDisplayFormPage,
     
    17561759
    17571760    @property
    1758     def payment(self):
    1759         return get_payments_from_payable_id(self.context.contract_id)
     1761    def payment_tuples(self):
     1762        payment_tuples = []
     1763        for payment in get_payments_from_payable_id(self.context.contract_id):
     1764            form_fields = grok.AutoFields(payment.form_fields_interface).omit(
     1765                'payment_items')
     1766            form_fields[
     1767                'creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     1768            form_fields[
     1769                'payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     1770            payment_tuples.append((payment, form_fields))
     1771        return payment_tuples
    17601772
    17611773    def render(self):
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py

    r12772 r12793  
    12991299        self.payment.gateway_service = 'demo_creditcard'
    13001300        self.payment.state = STATE_PAID
     1301        self.payment.title = u'My payment'
    13011302        self.app['payments'][self.payment.payment_id] = self.payment
    13021303
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/utils.py

    r12772 r12793  
    395395
    396396        # Insert payment data
    397         if getattr(view, 'payment', None) is not None:
    398             data_header = trans(_('Payment Data'), portal_language)
     397        if getattr(view, 'payment_tuples', None) is not None:
     398            data_header = trans(_('Payments'), portal_language)
    399399            data.append(Paragraph(data_header, HEADING_STYLE))
    400             for payment in getattr(view, 'payment', None):
     400            payment_number = 0
     401            for payment_tuple in getattr(view, 'payment_tuples', None):
     402                payment_number += 1
     403                payment = payment_tuple[0]
     404                payment_form_fields = payment_tuple[1]
    401405                if payment.state != STATE_PAID:
    402406                    continue
    403                 data.append(Paragraph('Payment', HEADLINE1_STYLE))
    404                 # XXX: Collect and render payment data
     407                data.append(Paragraph("Payment %s" % payment_number, HEADLINE1_STYLE))
     408                separators = getattr(self, 'SEPARATORS_DICT', {})
     409                table = creator.getWidgetsTable(
     410                    payment_form_fields, payment, None, lang=portal_language,
     411                    separators=separators)
     412                data.append(table)
    405413
    406414        # Insert scanned docs
  • main/waeup.ikoba/trunk/src/waeup/ikoba/payments/payment.py

    r12790 r12793  
    185185    grok.provides(IPayment)
    186186
     187    form_fields_interface = IPayment
     188
    187189    @property
    188190    def amount(self):
Note: See TracChangeset for help on using the changeset viewer.