- Timestamp:
- 29 Dec 2014, 16:12:24 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/contracts.py
r12333 r12336 110 110 111 111 @property 112 def title(self): 113 return getattr( 114 getattr(self, 'product_object', None), 115 'contract_autotitle', None) 116 117 @property 112 118 def customer(self): 113 119 try: -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/interfaces.py
r12333 r12336 294 294 translated_class_name = Attribute('Translatable class name') 295 295 user_id = Attribute('Id of a user, actually the id of the customer') 296 title = Attribute('Title generated by the associated product') 296 297 297 298 contract_id = schema.TextLine( … … 299 300 required = False, 300 301 constraint=validate_uuid, 301 )302 303 title = schema.TextLine(304 title = _(u'Contract Title'),305 required = True,306 302 ) 307 303 -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/sample_contract_data.csv
r12333 r12336 1 class_name,contract_id,reg_number, title,product_object,document_object,product_options2 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,[]1 class_name,contract_id,reg_number,product_object,document_object,product_options 2 SampleContract,c3,1,SAM,DOC1,"[('Base Fee', '800.6', 'usd')]" 3 SampleContract,c4,2,SAM,DOC1,[] 4 SampleContract,c5,3,SAM,DOC1,[] 5 SampleContract,,1,SAM,DOC1,[] 6 SampleContract,c5,2,SAM,DOC1,[] 7 SampleContract,c6,3,SAM,NONEXISTENT,[] 8 SampleContract,c7,3,NONEXISTENT,DOC1,[] -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_batching.py
r12333 r12336 99 99 self.product = createObject('waeup.Product') 100 100 self.product.product_id = u'SAM' 101 self.product.title = u'Our Sam le Product'101 self.product.title = u'Our Sample Product' 102 102 self.product.contract_category = u'sample' 103 103 option = ProductOption() … … 145 145 # Add contract 146 146 contract = createObject('waeup.SampleContract') 147 contract.title = u'My Contract'148 147 contract.contract_id = u'CON1' 149 148 contract.product_object = self.product … … 490 489 fail_file = open(fail_file).read() 491 490 self.assertEqual(fail_file, 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'491 'reg_number,contract_id,class_name,product_object,document_object,product_options,--ERRORS--\r\n' 492 '2,c5,SampleContract,SAM,DOC1,[],This object already exists. Skipping.\r\n' 493 '3,c6,SampleContract,SAM,NONEXISTENT,[],document_object: Invalid value\r\n' 494 '3,c7,SampleContract,NONEXISTENT,DOC1,[],product_object: Invalid value\r\n' 496 495 ) 497 496 contract = self.processor.getEntry(dict(reg_number='1', … … 514 513 self.assertTrue( 515 514 'INFO - system - Customer Sample Contract Processor - sample_contract_data - ' 516 'X666666 - %s - updated: title=My 4th contract, '517 'product_o bject=SAM, document_object=DOC1' % conid515 'X666666 - %s - updated: product_object=SAM, document_object=DOC1, ' 516 'product_options=[]' % conid 518 517 in logcontent) 519 518 -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py
r12262 r12336 102 102 self.product = createObject('waeup.Product') 103 103 self.product.product_id = u'SAM' 104 self.product.title = u'Our Sam le Product'104 self.product.title = u'Our Sample Product' 105 105 self.product.contract_category = u'sample' 106 106 self.app['products'].addProduct(self.product) … … 125 125 self.customer['documents'].addDocument(self.document) 126 126 self.contract = createObject('waeup.SampleContract') 127 self.contract.title = u'My first contract'128 127 self.contract.contract_id = u'CON1' 129 128 self.assertRaises( … … 1163 1162 self.browser.getControl("Add contract").click() 1164 1163 self.browser.getControl(name="contype").value = ['SampleContract'] 1165 self.browser.getControl(name="form.title").value = 'My Sample Contract'1166 1164 self.browser.getControl("Add contract").click() 1167 1165 self.assertTrue('Sample Contract added.' in self.browser.contents) … … 1173 1171 self.browser.getLink("Manage").click() 1174 1172 self.browser.getControl(name="form.product_object").value = ['SAM'] 1175 self.browser.getControl(name="form.title").value = 'My second contract'1176 1173 self.browser.getControl("Save").click() 1177 1174 self.assertTrue('Form has been saved.' in self.browser.contents) … … 1206 1203 '- K1000000 - added: Sample Contract %s' 1207 1204 % contract.contract_id in logcontent) 1208 self.assertTrue(1209 'INFO - zope.mgr - customers.browser.ContractManageFormPage '1210 '- K1000000 - %s - saved: title' % conid1211 in logcontent)1212 1205 self.assertTrue( 1213 1206 'INFO - zope.mgr - K1000000 - %s - Submitted for approval' % conid … … 1238 1231 self.browser.getControl("Add contract").click() 1239 1232 self.browser.getControl(name="contype").value = ['SampleContract'] 1240 self.browser.getControl(name="form.title").value = 'My Sample Contract'1241 1233 self.browser.getControl("Add contract").click() 1242 1234 self.assertTrue('Sample Contract added.' in self.browser.contents) … … 1250 1242 IWorkflowState(self.customer).setState(APPROVED) 1251 1243 self.browser.open(self.contracts_path + '/%s/edit' % conid) 1252 self.browser.getControl(name="form.title").value = 'My second contract'1253 1244 # SAM is in the correct contract_category ... 1254 1245 self.assertTrue('<option value="SAM">' in self.browser.contents) … … 1268 1259 self.browser.getControl(name="form.product_object").value = ['SAM'] 1269 1260 self.browser.getControl(name="form.document_object").value = ['DOC1'] 1270 self.browser.getControl(name="form.title").value = 'My second contract'1271 1261 self.browser.getControl("Save").click() 1272 1262 # After saving the form, last_product_id and other attributes are set 1273 1263 self.assertTrue('Form has been saved.' in self.browser.contents) 1274 1264 self.assertEqual(self.customer['contracts'][conid].last_product_id, 'SAM') 1275 self.assertEqual(contract.title, ' My second contract')1265 self.assertEqual(contract.title, 'Our Sample Product') 1276 1266 self.assertEqual(contract.product_object, self.product) 1277 1267 self.assertEqual(contract.document_object, self.document) 1278 1268 # Saving the form again does not unset last_product_id 1279 self.browser.getControl(name="form.title").value = 'My third contract'1280 1269 self.browser.getControl("Save").click() 1281 1270 self.assertEqual(self.customer['contracts'][conid].last_product_id, 'SAM') … … 1291 1280 # Customer can submit the form. The form is also saved. 1292 1281 self.browser.getLink("Edit").click() 1293 self.browser.getControl(name="form.title").value = 'My fourth contract' 1294 self.browser.getControl("Apply now").click() 1295 self.assertEqual(contract.title, 'My fourth contract') 1282 self.browser.getControl("Apply now").click() 1296 1283 self.assertEqual(contract.state, 'submitted') 1297 1284 self.assertTrue('Contract State: submitted for approval' in self.browser.contents) -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_catalog.py
r12259 r12336 62 62 product = createObject('waeup.Product') 63 63 product.product_id = u'SAM' 64 product.title = u'Our Sam le Product'64 product.title = u'Our Sample Product' 65 65 product.contract_category = u'sample' 66 66 self.app['products'].addProduct(product) … … 69 69 70 70 document = createObject('waeup.CustomerSampleDocument') 71 document.title = u'My Sam le Document'71 document.title = u'My Sample Document' 72 72 IWorkflowState(document).setState(VERIFIED) 73 73 self.customer['documents'].addDocument(document) … … 76 76 77 77 contract = createObject('waeup.SampleContract') 78 contract.title = u'My Samle Contract'79 78 contract.contract_id = u'CON1' 80 79 contract.product_object = product -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_export.py
r12330 r12336 278 278 'Contract created by system\'],,' 279 279 'SAM,"[(u\'Base Fee\', u\'800.6\', u\'usd\')]",' 280 'created, My Contract,A111111\r\n',280 'created,Our Sample Product,A111111\r\n', 281 281 result 282 282 ) … … 298 298 'Contract created by system\'],,' 299 299 'SAM,"[(u\'Base Fee\', u\'800.6\', u\'usd\')]",' 300 'created, My Contract,A111111\r\n',300 'created,Our Sample Product,A111111\r\n', 301 301 result 302 302 ) … … 318 318 'Contract created by system\'],,' 319 319 'SAM,"[(u\'Base Fee\', u\'800.6\', u\'usd\')]",' 320 'created, My Contract,A111111\r\n',321 result 322 ) 323 return 324 320 'created,Our Sample Product,A111111\r\n', 321 result 322 ) 323 return 324 -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_interfaces.py
r12256 r12336 68 68 69 69 contract = createObject('waeup.SampleContract') 70 contract.title = u'My Samle Contract'71 70 contract.product = product 72 71 contract.last_product_id = product.product_id … … 76 75 77 76 document = createObject('waeup.CustomerSampleDocument') 78 document.title = u'My Sam le Document'77 document.title = u'My Sample Document' 79 78 document.document_id = u'DOC1' 80 79 self.customer['documents'].addDocument(document) … … 108 107 source = CustomerDocumentSource() 109 108 result = source.factory.getTitle(object(), self.document) 110 self.assertEqual(result, u'DOC1 - My Sam le Document')109 self.assertEqual(result, u'DOC1 - My Sample Document') 111 110 -
main/waeup.ikoba/trunk/src/waeup/ikoba/products/interfaces.py
r12327 r12336 57 57 ) 58 58 59 contract_title = schema.TextLine( 60 title = _(u'Product Title'), 61 description = _('Product title if empty'), 62 required = False, 63 ) 64 59 65 contract_category = schema.Choice( 60 66 title = _(u'Contract Category'), -
main/waeup.ikoba/trunk/src/waeup/ikoba/products/product.py
r12334 r12336 51 51 return cc_dict[self.contract_category] 52 52 53 @property 54 def contract_autotitle(self): 55 if self.contract_title: 56 return self.contract_title 57 return self.title 58 53 59 Product = attrs_to_fields(Product) 54 60 -
main/waeup.ikoba/trunk/src/waeup/ikoba/products/tests/test_export.py
r12315 r12336 62 62 result = open(self.outfile, 'rb').read() 63 63 self.assertTrue( 64 'contract_category,options,product_id,title,users_with_local_roles\r\n' 65 'license,"[(u\'Base Fee\', u\'800.6\', u\'usd\')]",LIC,Unnamed,' 64 'contract_category,contract_title,options,' 65 'product_id,title,users_with_local_roles\r\n' 66 'license,,"[(u\'Base Fee\', u\'800.6\', u\'usd\')]",LIC,Unnamed,' 66 67 '"[{\'user_name\': u\'john\', \'local_role\': ' 67 68 'u\'johnsrole\'}]"\r\n' … … 76 77 result = open(self.outfile, 'rb').read() 77 78 self.assertTrue( 78 'contract_category,options,product_id,title,users_with_local_roles\r\n' 79 'license,"[(u\'Base Fee\', u\'800.6\', u\'usd\')]",LIC,Unnamed,' 79 'contract_category,contract_title,options,' 80 'product_id,title,users_with_local_roles\r\n' 81 'license,,"[(u\'Base Fee\', u\'800.6\', u\'usd\')]",LIC,Unnamed,' 80 82 '"[{\'user_name\': u\'john\', \'local_role\': ' 81 83 'u\'johnsrole\'}]"\r\n'
Note: See TracChangeset for help on using the changeset viewer.