Ignore:
Timestamp:
6 Dec 2016, 07:46:48 (8 years ago)
Author:
Henrik Bettermann
Message:

Add customer fields.

Location:
main/ikobacustom.aaue/trunk/src/ikobacustom/aaue/customers
Files:
3 edited

Legend:

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

    r14310 r14313  
    1717##
    1818
     19import grok
    1920from zope.component import getUtility
    2021from waeup.ikoba.interfaces import IIkobaUtils, IExtFileStore
     
    3839
    3940    def dataNotComplete(self):
    40         store = getUtility(IExtFileStore)
    41         error = ''
    42         if not store.getFileByContext(self.context, attr=u'passport.jpg'):
    43             error += _('Passport picture is missing.')
    44         if error:
    45             return error
    4641        return
     42
     43    @property
     44    def form_fields(self):
     45        if not self.is_requestable():
     46            return grok.AutoFields(
     47                self.context.form_fields_interface).select(
     48                    'email', 'phone', 'inst', 'postal_address')
     49        return grok.AutoFields(self.context.form_fields_interface).omit(
     50            'suspended', 'suspended_comment', 'reg_number', 'customer_id')
  • main/ikobacustom.aaue/trunk/src/ikobacustom/aaue/customers/interfaces.py

    r14310 r14313  
    3131
    3232    """
     33
     34    inst = schema.TextLine(
     35        title = _(u'Institution'),
     36        required = False,
     37        )
     38
     39    postal_address = schema.Text(
     40        title = _(u'Postal Address'),
     41        required = False,
     42        )
    3343
    3444# Customer document interfaces
  • main/ikobacustom.aaue/trunk/src/ikobacustom/aaue/customers/tests/test_browser.py

    r14310 r14313  
    8181        result = open(self.outfile, 'rb').read()
    8282        self.assertEqual(result,
    83             'customer_id,email,firstname,lastname,middlename,phone,'
     83            'customer_id,email,firstname,inst,lastname,middlename,phone,postal_address,'
    8484            'reg_number,sex,suspended,suspended_comment,password,state,history\r\n'
    85             'K1000000,aa@aa.aa,Beate,Mueller,,,123,f,0,,,started,[]\r\n')
     85            'K1000000,aa@aa.aa,Beate,,Mueller,,,,123,f,0,,,started,[]\r\n')
    8686        # We can reimport the file ...
    8787        processor = AAUECustomerProcessor()
     
    317317        self.contract.tc_dict = {'en': u'<strong>Hello world</strong>'}
    318318        self.contract.title = u'Contract Title'
    319         self.browser.open(self.customer_path + '/contracts/CON1')
     319        self.browser.open(
     320            self.customer_path + '/contracts/%s' % self.contract.contract_id)
    320321        self.browser.getLink("Download contract slip").click()
    321322        self.assertEqual(self.browser.headers['Status'], '200 Ok')
Note: See TracChangeset for help on using the changeset viewer.