Changeset 14807 for main


Ignore:
Timestamp:
18 Aug 2017, 10:26:59 (7 years ago)
Author:
Henrik Bettermann
Message:

Disable the deletion of applicant payment tickets.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.dspg/trunk/src/kofacustom/dspg/applicants/browser.py

    r14732 r14807  
    2121from zope.component import getUtility
    2222from zope.i18n import translate
     23from hurry.workflow.interfaces import IWorkflowState
    2324from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget
    2425from zope.formlib.textwidgets import BytesDisplayWidget
     
    3233    PaymentReceiptActionButton, PDFActionButton)
    3334from waeup.kofa.applicants.pdf import PDFApplicationSlip
     35from waeup.kofa.applicants.workflow import ADMITTED, PAID, STARTED
    3436from kofacustom.nigeria.applicants.interfaces import (
    3537    UG_OMIT_DISPLAY_FIELDS,
     
    178180    """
    179181
    180     @property
    181     def form_fields(self):
    182 
     182    def unremovable(self, ticket):
     183        return True
     184
     185    @property
     186    def form_fields(self):
    183187        if self.context.special:
    184188            form_fields = grok.AutoFields(ISpecialApplicant).omit(
     
    200204        return form_fields
    201205
     206    @property
     207    def display_actions(self):
     208        state = IWorkflowState(self.context).getState()
     209        # If the form is unlocked, applicants are allowed to save the form
     210        # and remove unused tickets.
     211        actions = [[_('Save')], []]
     212        # Only in state started they can also add tickets.
     213        if state == STARTED:
     214            actions = [[_('Save')],
     215                [_('Add online payment ticket'),]]
     216        # In state paid, they can submit the data and further add tickets
     217        # if the application is special.
     218        elif self.context.special and state == PAID:
     219            actions = [[_('Save'), _('Finally Submit')],
     220                [_('Add online payment ticket'),]]
     221        elif state == PAID:
     222            actions = [[_('Save'), _('Finally Submit')], []]
     223        return actions
     224
    202225class CustomApplicationFeePaymentAddPage(ApplicationFeePaymentAddPage):
    203226    """ Page to add an online payment ticket
Note: See TracChangeset for help on using the changeset viewer.