Changeset 12059 for main


Ignore:
Timestamp:
25 Nov 2014, 17:39:53 (10 years ago)
Author:
Henrik Bettermann
Message:

Add pdf download button to downloads page.

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba/customers
Files:
3 edited

Legend:

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

    r12056 r12059  
    935935    """Deliver an overview slip.
    936936    """
    937     grok.context(ICustomer)
     937    grok.context(ICustomerDocumentsContainer)
    938938    grok.name('overview_slip.pdf')
    939939    grok.require('waeup.viewCustomer')
     
    950950        return translate(_('Documents of'),
    951951            'waeup.ikoba', target_language=portal_language) \
    952             + ' %s' % self.context.display_fullname
     952            + ' %s' % self.context.customer.display_fullname
    953953
    954954    @property
     
    972972        for i in range(1,3):
    973973            tabledata.append(sorted(
    974                 [value for value in self.context['documents'].values()]))
     974                [value for value in self.context.values()]))
    975975            tableheader.append([(Id, 'document_id', 2),
    976976                             (Title, 'title', 6),
     
    979979                             (LT, 'formatted_transition_date', 3),
    980980                             ])
    981         customerview = CustomerBasePDFFormPage(self.context,
     981        customerview = CustomerBasePDFFormPage(self.context.customer,
    982982            self.request, self.omit_fields)
    983983        customers_utils = getUtility(ICustomersUtils)
    984984        return customers_utils.renderPDF(
    985985            self, 'overview_slip.pdf',
    986             self.context, customerview,
     986            self.context.customer, customerview,
    987987            tableheader=tableheader,
    988988            tabledata=tabledata,
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py

    r12058 r12059  
    10261026        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    10271027        # Officers can open the pdf transcript
    1028         self.browser.open(self.customer_path + '/overview_slip.pdf')
     1028        self.browser.open(self.customer_path + '/documents')
     1029        self.browser.getLink("Download documents overview").click()
    10291030        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    10301031        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/viewlets.py

    r12028 r12059  
    287287
    288288
    289 # Viewlets for customer cocuments
    290 
     289# Viewlets for customer documents
    291290
    292291class AddDocumentActionButton(AddActionButton):
     
    297296    text = _('Add document')
    298297    target = 'adddoc'
     298
     299
     300class PDFSlipActionButton(ManageActionButton):
     301    grok.order(2)
     302    grok.context(ICustomerDocumentsContainer)
     303    grok.view(DocumentsManageFormPage)
     304    grok.require('waeup.viewCustomer')
     305    icon = 'actionicon_pdf.png'
     306    text = _('Download documents overview')
     307    target = 'overview_slip.pdf'
    299308
    300309
Note: See TracChangeset for help on using the changeset viewer.