Changeset 12333 for main/waeup.ikoba/trunk/src/waeup
- Timestamp:
- 29 Dec 2014, 06:10:50 (10 years ago)
- 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 43 43 from waeup.ikoba.customers.interfaces import ( 44 44 ICustomer, ICustomerUpdateByRegNo, 45 ICustomerSampleDocument, ISampleContract )45 ICustomerSampleDocument, ISampleContractProcess) 46 46 from waeup.ikoba.customers.workflow import ( 47 47 IMPORTABLE_REGISTRATION_STATES, IMPORTABLE_REGISTRATION_TRANSITIONS) … … 561 561 562 562 name = _('Customer Sample Contract Processor') 563 iface = ISampleContract 563 iface = ISampleContractProcess 564 564 factory_name = 'waeup.SampleContract' -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser.py
r12300 r12333 1166 1166 1167 1167 form_fields = grok.AutoFields(IContract).omit( 1168 'product_object', 'contract_id' )1168 'product_object', 'contract_id', 'product_options') 1169 1169 1170 1170 @property … … 1218 1218 1219 1219 class ContractManageFormPage(IkobaEditFormPage): 1220 """ Page to edita contract1220 """ Page to manage a contract 1221 1221 """ 1222 1222 grok.context(IContract) -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/contracts.py
r12289 r12333 31 31 from waeup.ikoba.customers.interfaces import ( 32 32 IContractsContainer, ICustomerNavigation, 33 IContract, IContract Edit, ICustomersUtils,34 ISampleContract, ISampleContract Edit)33 IContract, IContractProcess, IContractEdit, ICustomersUtils, 34 ISampleContract, ISampleContractProcess, ISampleContractEdit) 35 35 from waeup.ikoba.customers.utils import generate_contract_id 36 36 from waeup.ikoba.utils.helpers import attrs_to_fields … … 61 61 """This is a customer contract baseclass. 62 62 """ 63 grok.implements(IContract, IContractEdit, ICustomerNavigation) 64 grok.provides(IContract) 63 65 64 grok.baseclass() 66 65 … … 164 163 """ 165 164 166 grok.implements(ISampleContract, ISampleContractEdit, ICustomerNavigation) 165 grok.implements( 166 ISampleContractProcess, # must come before ISampleContract 167 ISampleContract, 168 ISampleContractEdit, 169 ICustomerNavigation) 167 170 168 171 contract_category = 'sample' -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/interfaces.py
r12329 r12333 27 27 from waeup.ikoba.browser.interfaces import ICustomerNavigationBase 28 28 from waeup.ikoba.documents.interfaces import IDocumentsContainer, IDocument 29 from waeup.ikoba.products.productoptions import ProductOptionField 29 30 30 31 from waeup.ikoba.customers.vocabularies import ( … … 323 324 324 325 326 class 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 325 339 class IContractEdit(IContract): 326 340 """Interface for editing contract data by customers. … … 347 361 348 362 363 class 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 349 376 class ISampleContractEdit(ISampleContract): 350 377 """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 1 class_name,contract_id,reg_number,title,product_object,document_object,product_options 2 SampleContract,c3,1,My first contract,SAM,DOC1,"[('Base Fee', '800.6', 'usd')]" 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,[] -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_batching.py
r12330 r12333 490 490 fail_file = open(fail_file).read() 491 491 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' 496 496 ) 497 497 contract = self.processor.getEntry(dict(reg_number='1', … … 500 500 self.app['customers']['X666666']['contracts']['c3'], 501 501 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') 502 505 self.assertEqual(contract.contract_id, 'c3') 503 506 contract = self.processor.getEntry(dict(reg_number='3',
Note: See TracChangeset for help on using the changeset viewer.