Changeset 12214 for main/waeup.ikoba/trunk/src/waeup/ikoba/customers
- Timestamp:
- 13 Dec 2014, 15:46:41 (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/browser.py
r12210 r12214 769 769 mapping = {'a':self.context.__parent__.display_fullname}) 770 770 771 @action(_('Add document'), validator=NullValidator, style='primary') 772 def addDocument(self, **data): 773 self.redirect(self.url(self.context, 'adddoc')) 774 return 775 771 776 @jsaction(_('Remove selected documents')) 772 777 def delDocument(self, **data): … … 803 808 grok.template('documentaddform') 804 809 grok.require('waeup.editCustomerDocuments') 805 form_fields = grok.AutoFields(ICustomerDocument)806 810 label = _('Add document') 807 811 pnav = 4 … … 812 816 return sorted(doctypes.items()) 813 817 814 @action(_(' Createdocument'), style='primary')818 @action(_('Add document'), style='primary') 815 819 def createDocument(self, **data): 816 820 form = self.request.form … … 820 824 # classes depending on the doctype parameter given in form. 821 825 document = createObject('waeup.%s' % doctype) 826 self.applyData(document, **data) 822 827 self.context.addDocument(document) 823 828 doctype = getUtility(ICustomersUtils).SELECTABLE_DOCTYPES_DICT[doctype] 824 self.flash(_('${a} created.', 825 mapping = {'a': doctype})) 829 self.flash(_('${a} added.', mapping = {'a': doctype})) 826 830 self.context.writeLogMessage( 827 831 self,'added: %s %s' % (doctype, document.document_id)) … … 841 845 grok.require('waeup.viewCustomer') 842 846 grok.template('documentpage') 843 form_fields = grok.AutoFields(ICustomerDocument) 844 pnav = 4 847 pnav = 4 848 849 @property 850 def form_fields(self): 851 return grok.AutoFields(self.context.form_fields_interface) 845 852 846 853 @property … … 856 863 grok.require('waeup.manageCustomer') 857 864 grok.template('documenteditpage') 858 form_fields = grok.AutoFields(ICustomerDocument)859 865 pnav = 4 860 866 deletion_warning = _('Are you sure?') 867 868 @property 869 def form_fields(self): 870 return grok.AutoFields(self.context.form_fields_interface) 861 871 862 872 def update(self): … … 1102 1112 mapping = {'a':self.context.__parent__.display_fullname}) 1103 1113 1114 @action(_('Add contract'), validator=NullValidator, style='primary') 1115 def addContract(self, **data): 1116 self.redirect(self.url(self.context, 'addcontract')) 1117 return 1118 1104 1119 @jsaction(_('Remove selected contracts')) 1105 1120 def delContract(self, **data): … … 1133 1148 """ 1134 1149 grok.context(IContractsContainer) 1135 grok.name('add app')1150 grok.name('addcontract') 1136 1151 grok.template('contractaddform') 1137 1152 grok.require('waeup.editContracts') 1138 form_fields = grok.AutoFields(IContract)1139 1153 label = _('Add contract') 1140 1154 pnav = 4 … … 1145 1159 return sorted(contypes.items()) 1146 1160 1147 @action(_(' Createcontract'), style='primary')1161 @action(_('Add contract'), style='primary') 1148 1162 def createContract(self, **data): 1149 1163 form = self.request.form … … 1155 1169 self.context.addContract(contract) 1156 1170 contype = getUtility(ICustomersUtils).SELECTABLE_CONTYPES_DICT[contype] 1157 self.flash(_('${a} created.', 1158 mapping = {'a': contype})) 1171 self.flash(_('${a} added.', mapping = {'a': contype})) 1159 1172 self.context.writeLogMessage( 1160 1173 self,'added: %s %s' % (contype, contract.contract_id)) -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/documents.py
r12213 r12214 86 86 try: 87 87 TRANSLATED_STATES = getUtility( 88 I DocumentsUtils).TRANSLATED_DOCUMENT_STATES88 ICustomersUtils).TRANSLATED_DOCUMENT_STATES 89 89 return TRANSLATED_STATES[self.state] 90 90 except KeyError: … … 187 187 filenames = ('sample',) 188 188 189 form_fields_interface = ICustomerDocument 190 189 191 CustomerSampleDocument = attrs_to_fields(CustomerSampleDocument) 190 192 … … 201 203 # tuple should contain only a single filename string. 202 204 filenames = ('sample.pdf',) 205 206 form_fields_interface = ICustomerPDFDocument 203 207 204 208 CustomerPDFDocument = attrs_to_fields(CustomerPDFDocument) -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/interfaces.py
r12210 r12214 242 242 is_editable_by_customer = Attribute('Document editable by customer') 243 243 is_editable_by_manager = Attribute('Document editable by manager') 244 translated_class_name = Attribute('Translatable class name')245 244 246 245 -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py
r12213 r12214 471 471 def test_login_as_customer(self): 472 472 # CustomerImpersonators can login as customer 473 # Create clearance officer474 473 self.app['users'].addUser('mrofficer', 'mrofficersecret') 475 474 self.app['users']['mrofficer'].email = 'mrofficer@foo.ng' … … 827 826 self.browser.open(self.customer_path) 828 827 self.browser.getLink("Documents", index=1).click() 829 self.browser.get Link("Add document").click()828 self.browser.getControl("Add document").click() 830 829 self.browser.getControl(name="doctype").value = ['CustomerPDFDocument'] 831 self.browser.getControl(" Createdocument").click()832 self.assertTrue('PDF Document created.' in self.browser.contents)830 self.browser.getControl("Add document").click() 831 self.assertTrue('PDF Document added.' in self.browser.contents) 833 832 document = self.customer['documents']['d102'] 834 833 … … 898 897 '...You logged in...', self.browser.contents) 899 898 self.browser.getLink("Documents").click() 900 self.browser.get Link("Add document").click()899 self.browser.getControl("Add document").click() 901 900 self.browser.getControl(name="doctype").value = ['CustomerSampleDocument'] 902 self.browser.getControl(" Createdocument").click()903 self.assertTrue('Sample Document created.' in self.browser.contents)901 self.browser.getControl("Add document").click() 902 self.assertTrue('Sample Document added.' in self.browser.contents) 904 903 document = self.customer['documents']['d102'] 905 904 … … 1036 1035 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 1037 1036 self.browser.open(self.customer_path + '/documents') 1038 self.browser.get Link("Add document").click()1037 self.browser.getControl("Add document").click() 1039 1038 self.browser.getControl(name="doctype").value = ['CustomerPDFDocument'] 1040 self.browser.getControl(" Createdocument").click()1039 self.browser.getControl("Add document").click() 1041 1040 self.browser.open(self.documents_path + '/d102/manage') 1042 1041 # Create a pseudo image file and select it to be uploaded … … 1137 1136 self.browser.open(self.customer_path) 1138 1137 self.browser.getLink("Contracts").click() 1139 self.browser.get Link("Add contract").click()1138 self.browser.getControl("Add contract").click() 1140 1139 self.browser.getControl(name="contype").value = ['SampleContract'] 1141 self.browser.getControl(" Createcontract").click()1142 self.assertTrue('Sample Contract created.' in self.browser.contents)1140 self.browser.getControl("Add contract").click() 1141 self.assertTrue('Sample Contract added.' in self.browser.contents) 1143 1142 contract = self.customer['contracts']['c102'] 1144 1143 … … 1200 1199 '...You logged in...', self.browser.contents) 1201 1200 self.browser.getLink("Contracts").click() 1202 self.browser.get Link("Add contract").click()1201 self.browser.getControl("Add contract").click() 1203 1202 self.browser.getControl(name="contype").value = ['SampleContract'] 1204 self.browser.getControl(" Createcontract").click()1205 self.assertTrue('Sample Contract created.' in self.browser.contents)1203 self.browser.getControl("Add contract").click() 1204 self.assertTrue('Sample Contract added.' in self.browser.contents) 1206 1205 contract = self.customer['contracts']['c102'] 1207 1206 # Contract can be edited ... -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/utils.py
r12199 r12214 306 306 } 307 307 308 309 308 TRANSLATED_CONTRACT_STATES = { 310 309 CREATED: _('created'), 311 310 SUBMITTED: _('submitted for approval'), 312 311 APPROVED: _('approved'), 312 REJECTED: _('rejected'), 313 EXPIRED:_('expired') 314 } 315 316 TRANSLATED_DOCUMENT_STATES = { 317 CREATED: _('created'), 318 SUBMITTED: _('submitted for verification'), 319 VERIFIED: _('verified'), 313 320 REJECTED: _('rejected'), 314 321 EXPIRED:_('expired') -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/viewlets.py
r12167 r12214 300 300 # Viewlets for customer documents 301 301 302 class AddDocumentActionButton(AddActionButton):303 grok.order(1)304 grok.context(ICustomerDocumentsContainer)305 grok.view(DocumentsManageFormPage)306 grok.require('waeup.editCustomerDocuments')307 text = _('Add document')308 target = 'adddoc'309 310 311 302 class PDFDocumentOverviewActionButton(ManageActionButton): 312 303 grok.order(2) … … 378 369 target = 'document_slip.pdf' 379 370 371 380 372 # Viewlets for customer contracts 381 382 class AddContractActionButton(AddActionButton):383 grok.order(1)384 grok.context(IContractsContainer)385 grok.view(ContractsManageFormPage)386 grok.require('waeup.editContracts')387 text = _('Add contract')388 target = 'addapp'389 390 373 391 374 class PDFContractOverviewActionButton(ManageActionButton):
Note: See TracChangeset for help on using the changeset viewer.