Changeset 12527
- Timestamp:
- 31 Jan 2015, 07:13:52 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba/customers
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser.py
r12526 r12527 38 38 IContactForm, IObjectHistory, IIkobaObject, IIkobaUtils, 39 39 IPasswordValidator, IUserAccount, 40 VERIFIED, REJECTED, EXPIRED, CREATED, REQUESTED, APPROVED, PROVISIONALLY) 40 STARTED, VERIFIED, REJECTED, EXPIRED, CREATED, REQUESTED, 41 APPROVED, PROVISIONALLY) 41 42 from waeup.ikoba.browser.layout import ( 42 43 IkobaPage, IkobaEditFormPage, IkobaAddFormPage, IkobaDisplayFormPage, … … 389 390 return grok.AutoFields( 390 391 self.context.form_fields_interface).omit( 391 'customer_id', ' adm_code', 'suspended')392 'customer_id', 'suspended') 392 393 393 394 def update(self): … … 673 674 return 674 675 676 # Pages for customers 675 677 676 678 class CustomerFilesUploadPage(IkobaPage): … … 680 682 """ 681 683 grok.context(ICustomer) 682 grok.name(' change_portrait')684 grok.name('upload_files') 683 685 grok.require('waeup.handleCustomer') 684 686 grok.template('filesuploadpage') 685 label = _(' Change portrait')687 label = _('Upload files') 686 688 pnav = 4 687 689 … … 689 691 CUSTMANAGE_STATES = getUtility( 690 692 ICustomersUtils).CUSTMANAGE_CUSTOMER_STATES 691 if self.context. customer.state not in CUSTMANAGE_STATES:693 if self.context.state not in CUSTMANAGE_STATES: 692 694 emit_lock_message(self) 693 695 return … … 698 700 return 699 701 700 # Pages for customers701 702 702 703 703 class CustomerBaseEditFormPage(IkobaEditFormPage): … … 708 708 grok.require('waeup.handleCustomer') 709 709 pnav = 4 710 711 def is_requestable(self, action=None): 712 if self.context.state == STARTED: 713 return True 714 return False 710 715 711 716 @property … … 717 722 @property 718 723 def form_fields(self): 719 if self.context.state in (REQUESTED, PROVISIONALLY, APPROVED):724 if not self.is_requestable(): 720 725 return grok.AutoFields(ICustomer).select('email', 'phone') 721 726 return grok.AutoFields(ICustomer).omit( … … 727 732 return 728 733 729 def is_requestable(self, action=None): 730 if self.context.state in (REQUESTED, PROVISIONALLY, APPROVED): 731 return False 732 return True 733 734 @action(_('Request registration now'), 734 @action(_('Save and request registration now'), 735 735 warning=WARNING_CUST, condition=is_requestable) 736 736 def finalsubmit(self, **data): -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py
r12526 r12527 620 620 '...You logged in...', self.browser.contents) 621 621 # Admitted customer can upload a passport picture 622 self.browser.getLink(" Change portrait").click()622 self.browser.getLink("Upload files").click() 623 623 ctrl = self.browser.getControl(name='passporteditupload') 624 624 file_obj = open(SAMPLE_IMAGE, 'rb') … … 644 644 self.browser.getLink("Edit").click() 645 645 self.browser.getControl(name="form.email").value = 'new_email@aa.ng' 646 self.browser.getControl("Save" ).click()646 self.browser.getControl("Save", index=1).click() 647 647 self.assertMatches('...Form has been saved...', 648 648 self.browser.contents) -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/viewlets.py
r12500 r12527 300 300 grok.view(CustomerBaseDisplayFormPage) 301 301 grok.require('waeup.handleCustomer') 302 icon = 'actionicon_ portrait.png'303 text = _(' Change portrait')304 target = ' change_portrait'302 icon = 'actionicon_up.png' 303 text = _('Upload files') 304 target = 'upload_files' 305 305 306 306 @property
Note: See TracChangeset for help on using the changeset viewer.