Ignore:
Timestamp:
20 Mar 2015, 18:51:29 (10 years ago)
Author:
Henrik Bettermann
Message:

Prepare products and contracts for annual payments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/browser.py

    r12617 r12803  
    2020from zope.component import getUtility
    2121from waeup.ikoba.interfaces import IIkobaUtils, IExtFileStore
     22from waeup.ikoba.browser.layout import action
    2223from waeup.ikoba.customers.browser import (
    23     PDFContractSlipPage, CustomerBaseEditFormPage)
     24    PDFContractSlipPage, CustomerBaseEditFormPage, ContractSelectProductPage, msave)
    2425from ikobacustom.pcn.interfaces import MessageFactory as _
    2526from ikobacustom.pcn.customers.interfaces import (
     
    8889            return error
    8990        return
     91
     92
     93class ContractSelectProductPage(ContractSelectProductPage):
     94    """ Page to select a contract product
     95
     96    This page is for both customers and officers.
     97    """
     98
     99    @action(_('Save and proceed'), style='primary')
     100    def save(self, **data):
     101        msave(self, **data)
     102        self.context.contract_year = self.context.product_object.contract_year
     103        self.context.title = self.context.product_object.contract_autotitle
     104        self.context.tc_dict = self.context.product_object.tc_dict
     105        self.context.valid_from = self.context.product_object.valid_from
     106        self.context.valid_to = self.context.product_object.valid_to
     107        isCustomer = getattr(
     108            self.request.principal, 'user_type', None) == 'customer'
     109        if isCustomer:
     110            self.redirect(self.url(self.context, 'edit'))
     111        else:
     112            self.redirect(self.url(self.context, 'manage'))
     113        return
Note: See TracChangeset for help on using the changeset viewer.