Changeset 12500 for main/waeup.ikoba/trunk
- Timestamp:
- 20 Jan 2015, 17:31:11 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba/customers
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser.py
r12490 r12500 1382 1382 1383 1383 1384 class ContractOfficialUsePage(IkobaEditFormPage): 1385 """ Page to manage a official use data of contract 1386 """ 1387 grok.context(IContract) 1388 grok.name('official_use') 1389 grok.require('waeup.manageCustomer') 1390 grok.template('contracteditpage') 1391 pnav = 4 1392 deletion_warning = _('Are you sure?') 1393 1394 @property 1395 def form_fields(self): 1396 return grok.AutoFields(self.context.ou_form_fields_interface) 1397 1398 @property 1399 def label(self): 1400 return self.context.title 1401 1402 @action(_('Save'), style='primary') 1403 def save(self, **data): 1404 msave(self, **data) 1405 return 1406 1407 1384 1408 class ContractEditFormPage(ContractManageFormPage): 1385 1409 """ Page to edit a contract by customer only -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/contracts.py
r12486 r12500 31 31 from waeup.ikoba.customers.interfaces import ( 32 32 IContractsContainer, ICustomerNavigation, 33 IContract, IContractProcess, IContractSelectProduct, ICustomersUtils, 34 ISampleContract, ISampleContractProcess, ISampleContractEdit) 33 IContract, IContractSelectProduct, ICustomersUtils, 34 ISampleContract, ISampleContractProcess, ISampleContractEdit, 35 ISampleContractOfficialUse) 35 36 from waeup.ikoba.customers.utils import generate_contract_id 36 37 from waeup.ikoba.utils.helpers import attrs_to_fields … … 64 65 65 66 grok.baseclass() 66 67 check_docs_interface = None68 69 contract_category = None70 71 form_fields_interface = None72 73 edit_form_fields_interface = None74 67 75 68 def __init__(self): … … 186 179 edit_form_fields_interface = ISampleContractEdit 187 180 181 ou_form_fields_interface = ISampleContractOfficialUse 182 188 183 check_docs_interface = ISampleContract 189 184 -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/export.py
r12483 r12500 28 28 from waeup.ikoba.customers.interfaces import ( 29 29 ICustomer, ICSVCustomerExporter, 30 ICustomerSampleDocument, ISampleContract )30 ICustomerSampleDocument, ISampleContractProcess) 31 31 from waeup.ikoba.utils.batching import ExporterBase 32 32 from waeup.ikoba.utils.helpers import iface_names, to_timezone … … 242 242 """ 243 243 grok.name('samplecontracts') 244 iface = ISampleContract 244 iface = ISampleContractProcess 245 245 class_name = 'SampleContract' 246 246 title = _(u'Customer Sample Contracts') -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/interfaces.py
r12487 r12500 321 321 322 322 323 class IContractProcess(IContract): 323 class IContractSelectProduct(Interface): 324 """Interface for for the ContractSelectProductPage. 325 326 """ 327 328 product_object = schema.Choice( 329 title = _(u'Product'), 330 source = ConCatProductSource(), 331 required = True, 332 ) 333 334 335 class ISampleContract(IContract): 336 """A customer contract sample with document attached. 337 338 """ 339 340 document_object = schema.Choice( 341 title = _(u'Document'), 342 source = CustomerDocumentSource(), 343 required = False, 344 ) 345 346 347 class ISampleContractOfficialUse(IIkobaObject): 348 """Interface for official use only. 349 """ 350 351 comment = schema.Text( 352 title = _(u'Comment'), 353 required = False, 354 ) 355 356 357 class ISampleContractProcess(ISampleContract, ISampleContractOfficialUse): 324 358 """Interface for processing contract data. 325 359 """ … … 334 368 335 369 336 class IContractSelectProduct(Interface): 337 """Interface for for the ContractSelectProductPage. 338 339 """ 340 341 product_object = schema.Choice( 342 title = _(u'Product'), 343 source = ConCatProductSource(), 344 required = True, 345 ) 346 347 348 class ISampleContract(IContract): 349 """A customer contract sample with document attached. 370 class ISampleContractEdit(ISampleContract): 371 """Interface for editing sample contract data by customers. 350 372 351 373 """ … … 354 376 title = _(u'Document'), 355 377 source = CustomerDocumentSource(), 356 required = False, 357 ) 358 359 360 class ISampleContractProcess(ISampleContract): 361 """Interface for processing contract data. 362 """ 363 364 product_options = schema.List( 365 title = _(u'Options/Fees'), 366 value_type = ProductOptionField(), 367 required = False, 368 readonly = False, 369 default = [], 370 ) 371 372 373 class ISampleContractEdit(ISampleContract): 374 """Interface for editing sample contract data by customers. 375 376 """ 377 378 document_object = schema.Choice( 379 title = _(u'Document'), 380 source = CustomerDocumentSource(), 381 required = True, 382 ) 378 required = True, 379 ) -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py
r12462 r12500 1215 1215 self.assertEqual(contract.state, 'approved') 1216 1216 1217 # Even in state approved the official use data can be edited 1218 self.browser.open(self.contracts_path + '/%s/index' % conid) 1219 self.browser.getLink("Manage official data").click() 1220 self.browser.getControl(name="form.comment").value = u'Nice place' 1221 self.browser.getControl("Save").click() 1222 self.assertEqual(contract.comment, 'Nice place') 1223 self.assertTrue('Form has been saved.' in self.browser.contents) 1224 1217 1225 # Contracts can be removed 1218 1226 self.browser.getLink("Contracts").click() -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_export.py
r12363 r12500 255 255 self.assertEqual( 256 256 result, 257 'class_name,co ntract_category,contract_id,document_object,'257 'class_name,comment,contract_category,contract_id,document_object,' 258 258 'history,last_product_id,' 259 259 'product_object,product_options,state,tc_dict,title,user_id\r\n' 260 260 261 'SampleContract, sample,CON1,,[],,,[],,{},,\r\n'261 'SampleContract,,sample,CON1,,[],,,[],,{},,\r\n' 262 262 ) 263 263 return … … 271 271 result = open(self.outfile, 'rb').read() 272 272 self.assertMatches( 273 'class_name,co ntract_category,contract_id,document_object,'273 'class_name,comment,contract_category,contract_id,document_object,' 274 274 'history,last_product_id,' 275 275 'product_object,product_options,state,tc_dict,title,user_id\r\n' 276 276 277 'SampleContract, sample,CON1,DOC1,[u\'2014-12-04 12:10:46 UTC - '277 'SampleContract,,sample,CON1,DOC1,[u\'2014-12-04 12:10:46 UTC - ' 278 278 'Contract created by system\'],,' 279 279 'SAM,"[(u\'Base Fee\', u\'800.6\', u\'USD\')]",' … … 291 291 result = open(self.outfile, 'rb').read() 292 292 self.assertMatches( 293 'class_name,co ntract_category,contract_id,document_object,'293 'class_name,comment,contract_category,contract_id,document_object,' 294 294 'history,last_product_id,' 295 295 'product_object,product_options,state,tc_dict,title,user_id\r\n' 296 296 297 'SampleContract, sample,CON1,DOC1,[u\'2014-12-04 12:10:46 UTC - '297 'SampleContract,,sample,CON1,DOC1,[u\'2014-12-04 12:10:46 UTC - ' 298 298 'Contract created by system\'],,' 299 299 'SAM,"[(u\'Base Fee\', u\'800.6\', u\'USD\')]",' … … 311 311 result = open(self.outfile, 'rb').read() 312 312 self.assertMatches( 313 'class_name,co ntract_category,contract_id,document_object,'313 'class_name,comment,contract_category,contract_id,document_object,' 314 314 'history,last_product_id,' 315 315 'product_object,product_options,state,tc_dict,title,user_id\r\n' 316 316 317 'SampleContract, sample,CON1,DOC1,[u\'2014-12-04 12:10:46 UTC - '317 'SampleContract,,sample,CON1,DOC1,[u\'2014-12-04 12:10:46 UTC - ' 318 318 'Contract created by system\'],,' 319 319 'SAM,"[(u\'Base Fee\', u\'800.6\', u\'USD\')]",' -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/viewlets.py
r12351 r12500 35 35 DocumentsManageFormPage, DocumentDisplayFormPage, DocumentManageFormPage, 36 36 ContractsFormPage, ContractDisplayFormPage, 37 ContractManageFormPage) 37 ContractManageFormPage, 38 ContractOfficialUsePage) 38 39 39 40 grok.context(IIkobaObject) # Make IIkobaObject the default context … … 405 406 406 407 408 class ContractOUActionButton(ManageActionButton): 409 grok.order(2) 410 grok.context(IContract) 411 grok.view(ContractDisplayFormPage) 412 grok.require('waeup.manageCustomer') 413 text = _('Manage official data') 414 target = 'official_use' 415 416 407 417 class ContractEditActionButton(ManageActionButton): 408 418 grok.order(1) … … 421 431 422 432 class ContractTrigTransActionButton(ManageActionButton): 423 grok.order( 2)433 grok.order(3) 424 434 grok.context(IContract) 425 435 grok.view(ContractDisplayFormPage) … … 440 450 441 451 452 class ContractViewActionButton2(ContractViewActionButton): 453 grok.view(ContractOfficialUsePage) 454 455 442 456 class PDFContractSlipActionButton(ManageActionButton): 443 grok.order( 3)457 grok.order(4) 444 458 grok.context(IContract) 445 459 grok.view(ContractDisplayFormPage)
Note: See TracChangeset for help on using the changeset viewer.