- Timestamp:
- 10 Jul 2022, 18:21:55 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.lpng/trunk/src/kofacustom/lpng/applicants/browser.py
r17019 r17020 20 20 import grok 21 21 from zope.formlib.textwidgets import BytesDisplayWidget 22 from zope.component import getUtility 23 from waeup.kofa.widgets.datewidget import ( 24 FriendlyDateDisplayWidget, 25 FriendlyDatetimeDisplayWidget) 22 26 from waeup.kofa.applicants.pdf import PDFApplicationSlip 23 27 from waeup.kofa.applicants.browser import ( … … 26 30 ApplicantManageFormPage, 27 31 ApplicantEditFormPage, 28 BalancePaymentAddFormPage) 29 32 BalancePaymentAddFormPage, 33 ExportPDFPaymentSlipPage, 34 ApplicantBaseDisplayFormPage) 35 from waeup.kofa.students.interfaces import IStudentsUtils 36 from waeup.kofa.applicants.interfaces import IApplicantOnlinePayment 37 from kofacustom.nigeria.applicants.interfaces import INigeriaApplicantOnlinePayment 38 from kofacustom.nigeria.applicants.browser import NigeriaExportPDFPaymentSlipPage 30 39 from kofacustom.lpng.applicants.interfaces import ( 31 40 ICustomApplicant, … … 33 42 ICustomApplicantEdit, 34 43 ) 35 36 44 from kofacustom.lpng.interfaces import MessageFactory as _ 37 45 … … 93 101 """ 94 102 grok.require('waeup.payApplicant') 103 104 class CustomApplicantBaseDisplayFormPage(ApplicantBaseDisplayFormPage): 95 105 106 @property 107 def form_fields(self): 108 form_fields = grok.AutoFields(ICustomApplicant).select( 109 'applicant_id', 'reg_number', 'email') 110 return form_fields 111 112 class CustomExportPDFPaymentSlipPage(NigeriaExportPDFPaymentSlipPage): 113 """Deliver a PDF slip of the context. 114 """ 115 # use IApplicantOnlinePayment alternativly 116 form_fields = grok.AutoFields(INigeriaApplicantOnlinePayment).omit( 117 'p_item').omit('p_option').omit('p_combi') 118 form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') 119 form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') 120 121 def render(self): 122 if self.payment_slip_download_warning: 123 self.flash(self.payment_slip_download_warning, type='danger') 124 self.redirect(self.url(self.context)) 125 return 126 applicantview = CustomApplicantBaseDisplayFormPage(self.context.__parent__, 127 self.request) 128 students_utils = getUtility(IStudentsUtils) 129 return students_utils.renderPDF(self,'payment_slip.pdf', 130 self.context.__parent__, applicantview, note=self.note, 131 omit_fields=())
Note: See TracChangeset for help on using the changeset viewer.