Ignore:
Timestamp:
29 Dec 2014, 06:10:50 (10 years ago)
Author:
Henrik Bettermann
Message:

Add interface for contract batch processor.

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

Legend:

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

    r12283 r12333  
    4343from waeup.ikoba.customers.interfaces import (
    4444    ICustomer, ICustomerUpdateByRegNo,
    45     ICustomerSampleDocument, ISampleContract)
     45    ICustomerSampleDocument, ISampleContractProcess)
    4646from waeup.ikoba.customers.workflow import  (
    4747    IMPORTABLE_REGISTRATION_STATES, IMPORTABLE_REGISTRATION_TRANSITIONS)
     
    561561
    562562    name = _('Customer Sample Contract Processor')
    563     iface = ISampleContract
     563    iface = ISampleContractProcess
    564564    factory_name = 'waeup.SampleContract'
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser.py

    r12300 r12333  
    11661166
    11671167    form_fields = grok.AutoFields(IContract).omit(
    1168         'product_object', 'contract_id')
     1168        'product_object', 'contract_id', 'product_options')
    11691169
    11701170    @property
     
    12181218
    12191219class ContractManageFormPage(IkobaEditFormPage):
    1220     """ Page to edit a contract
     1220    """ Page to manage a contract
    12211221    """
    12221222    grok.context(IContract)
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/contracts.py

    r12289 r12333  
    3131from waeup.ikoba.customers.interfaces import (
    3232    IContractsContainer, ICustomerNavigation,
    33     IContract, IContractEdit, ICustomersUtils,
    34     ISampleContract, ISampleContractEdit)
     33    IContract, IContractProcess, IContractEdit, ICustomersUtils,
     34    ISampleContract, ISampleContractProcess, ISampleContractEdit)
    3535from waeup.ikoba.customers.utils import generate_contract_id
    3636from waeup.ikoba.utils.helpers import attrs_to_fields
     
    6161    """This is a customer contract baseclass.
    6262    """
    63     grok.implements(IContract, IContractEdit, ICustomerNavigation)
    64     grok.provides(IContract)
     63
    6564    grok.baseclass()
    6665
     
    164163    """
    165164
    166     grok.implements(ISampleContract, ISampleContractEdit, ICustomerNavigation)
     165    grok.implements(
     166        ISampleContractProcess, # must come before ISampleContract
     167        ISampleContract,
     168        ISampleContractEdit,
     169        ICustomerNavigation)
    167170
    168171    contract_category = 'sample'
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/interfaces.py

    r12329 r12333  
    2727from waeup.ikoba.browser.interfaces import ICustomerNavigationBase
    2828from waeup.ikoba.documents.interfaces import IDocumentsContainer, IDocument
     29from waeup.ikoba.products.productoptions import ProductOptionField
    2930
    3031from waeup.ikoba.customers.vocabularies import (
     
    323324
    324325
     326class IContractProcess(IContract):
     327    """Interface for processing contract data.
     328    """
     329
     330    product_options = schema.List(
     331        title = _(u'Options/Fees'),
     332        value_type = ProductOptionField(),
     333        required = False,
     334        readonly = False,
     335        default = [],
     336        )
     337
     338
    325339class IContractEdit(IContract):
    326340    """Interface for editing contract data by customers.
     
    347361
    348362
     363class ISampleContractProcess(ISampleContract):
     364    """Interface for processing contract data.
     365    """
     366
     367    product_options = schema.List(
     368        title = _(u'Options/Fees'),
     369        value_type = ProductOptionField(),
     370        required = False,
     371        readonly = False,
     372        default = [],
     373        )
     374
     375
    349376class ISampleContractEdit(ISampleContract):
    350377    """Interface for editing sample contract data by customers.
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/sample_contract_data.csv

    r12256 r12333  
    1 class_name,contract_id,reg_number,title,product_object,document_object
    2 SampleContract,c3,1,My first contract,SAM,DOC1
    3 SampleContract,c4,2,My second contract,SAM,DOC1
    4 SampleContract,c5,3,My third contract,SAM,DOC1
    5 SampleContract,,1,My 4th contract,SAM,DOC1
    6 SampleContract,c5,2,My stolen contract,SAM,DOC1
    7 SampleContract,c6,3,My 5th contract,SAM,NONEXISTENT
    8 SampleContract,c7,3,My sixt contract,NONEXISTENT,DOC1
     1class_name,contract_id,reg_number,title,product_object,document_object,product_options
     2SampleContract,c3,1,My first contract,SAM,DOC1,"[('Base Fee', '800.6', 'usd')]"
     3SampleContract,c4,2,My second contract,SAM,DOC1,[]
     4SampleContract,c5,3,My third contract,SAM,DOC1,[]
     5SampleContract,,1,My 4th contract,SAM,DOC1,[]
     6SampleContract,c5,2,My stolen contract,SAM,DOC1,[]
     7SampleContract,c6,3,My 5th contract,SAM,NONEXISTENT,[]
     8SampleContract,c7,3,My sixt contract,NONEXISTENT,DOC1,[]
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_batching.py

    r12330 r12333  
    490490        fail_file = open(fail_file).read()
    491491        self.assertEqual(fail_file,
    492             'reg_number,contract_id,title,class_name,product_object,document_object,--ERRORS--\r\n'
    493             '2,c5,My stolen contract,SampleContract,SAM,DOC1,This object already exists. Skipping.\r\n'
    494             '3,c6,My 5th contract,SampleContract,SAM,NONEXISTENT,document_object: Invalid value\r\n'
    495             '3,c7,My sixt contract,SampleContract,NONEXISTENT,DOC1,product_object: Invalid value\r\n'
     492            'reg_number,contract_id,title,class_name,product_object,document_object,product_options,--ERRORS--\r\n'
     493            '2,c5,My stolen contract,SampleContract,SAM,DOC1,[],This object already exists. Skipping.\r\n'
     494            '3,c6,My 5th contract,SampleContract,SAM,NONEXISTENT,[],document_object: Invalid value\r\n'
     495            '3,c7,My sixt contract,SampleContract,NONEXISTENT,DOC1,[],product_object: Invalid value\r\n'
    496496            )
    497497        contract = self.processor.getEntry(dict(reg_number='1',
     
    500500            self.app['customers']['X666666']['contracts']['c3'],
    501501            contract)
     502        self.assertEqual(contract.product_options[0].title, 'Base Fee')
     503        self.assertEqual(contract.product_options[0].fee, Decimal('800.6') )
     504        self.assertEqual(contract.product_options[0].currency, 'usd')
    502505        self.assertEqual(contract.contract_id, 'c3')
    503506        contract = self.processor.getEntry(dict(reg_number='3',
Note: See TracChangeset for help on using the changeset viewer.