Changeset 12098
- Timestamp:
- 30 Nov 2014, 21:00:30 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/app.py
r12097 r12098 43 43 _curr_doc_id = 101 44 44 45 _curr_ app_id = 10145 _curr_con_id = 101 46 46 47 47 # Setup authentication for this app. Note: this is only … … 87 87 """ 88 88 # lock.acquire() # lock data 89 new_id = u' a%s' % (self._curr_app_id)90 self._curr_ app_id += 189 new_id = u'c%s' % (self._curr_con_id) 90 self._curr_con_id += 1 91 91 # self._p_changed = True 92 92 # commit() -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/interfaces.py
r12097 r12098 29 29 30 30 from waeup.ikoba.customers.vocabularies import ( 31 contextual_reg_num_source, GenderSource, nats_vocab, AppCatProductSource)31 contextual_reg_num_source, GenderSource, nats_vocab, ConCatProductSource) 32 32 33 33 … … 289 289 product = schema.Choice( 290 290 title = _(u'Product'), 291 source = AppCatProductSource(),291 source = ConCatProductSource(), 292 292 required = False, 293 293 ) … … 300 300 product = schema.Choice( 301 301 title = _(u'Product'), 302 source = AppCatProductSource(),303 required = True, 304 ) 302 source = ConCatProductSource(), 303 required = True, 304 ) -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py
r12097 r12098 1068 1068 self.browser.getControl("Create contract").click() 1069 1069 self.assertTrue('Sample Contract created.' in self.browser.contents) 1070 contract = self.customer['contracts'][' a102']1070 contract = self.customer['contracts']['c102'] 1071 1071 1072 1072 # Contract can be edited 1073 self.browser.getLink(" a102").click()1073 self.browser.getLink("c102").click() 1074 1074 self.browser.getLink("Manage").click() 1075 1075 self.browser.getControl(name="form.product").value = ['SAM'] … … 1078 1078 self.assertTrue('Form has been saved.' in self.browser.contents) 1079 1079 self.browser.getLink("View").click() 1080 self.assertEqual(self.browser.url, self.contracts_path + '/ a102/index')1080 self.assertEqual(self.browser.url, self.contracts_path + '/c102/index') 1081 1081 1082 1082 # Transitions can be performed … … 1101 1101 self.assertTrue( 1102 1102 'INFO - zope.mgr - customers.browser.ContractManageFormPage ' 1103 '- K1000000 - a102 - saved: title'1103 '- K1000000 - c102 - saved: title' 1104 1104 in logcontent) 1105 1105 self.assertTrue( … … 1131 1131 self.browser.getControl("Create contract").click() 1132 1132 self.assertTrue('Sample Contract created.' in self.browser.contents) 1133 contract = self.customer['contracts'][' a102']1133 contract = self.customer['contracts']['c102'] 1134 1134 # Contract can be edited ... 1135 self.browser.getLink(" a102").click()1136 self.browser.open(self.contracts_path + '/ a102/edit')1135 self.browser.getLink("c102").click() 1136 self.browser.open(self.contracts_path + '/c102/edit') 1137 1137 #self.browser.getLink("Edit").click() 1138 1138 self.assertTrue('The requested form is locked' in self.browser.contents) 1139 1139 # Customer is in wrong state 1140 1140 IWorkflowState(self.customer).setState(APPROVED) 1141 self.browser.open(self.contracts_path + '/ a102/edit')1141 self.browser.open(self.contracts_path + '/c102/edit') 1142 1142 self.browser.getControl(name="form.title").value = 'My second app' 1143 1143 # SAM is in the correct contract_category ... … … 1146 1146 self.assertFalse('<option value="LIC">' in self.browser.contents) 1147 1147 # So far last_product_id is None. 1148 self.assertTrue(self.customer['contracts'][' a102'].last_product_id is None)1148 self.assertTrue(self.customer['contracts']['c102'].last_product_id is None) 1149 1149 self.browser.getControl(name="form.product").value = ['SAM'] 1150 1150 self.browser.getControl("Save").click() 1151 1151 # After saving the form, last_product_id is set. 1152 self.assertEqual(self.customer['contracts'][' a102'].last_product_id, 'SAM')1152 self.assertEqual(self.customer['contracts']['c102'].last_product_id, 'SAM') 1153 1153 self.assertTrue('Form has been saved.' in self.browser.contents) 1154 1154 # Saving the form again does not unset last_product_id 1155 1155 self.assertEqual(contract.title, 'My second app') 1156 1156 self.browser.getControl("Save").click() 1157 self.assertEqual(self.customer['contracts'][' a102'].last_product_id, 'SAM')1157 self.assertEqual(self.customer['contracts']['c102'].last_product_id, 'SAM') 1158 1158 self.assertTrue('Form has been saved.' in self.browser.contents) 1159 1159 self.browser.getLink("View").click() 1160 self.assertEqual(self.browser.url, self.contracts_path + '/ a102/index')1160 self.assertEqual(self.browser.url, self.contracts_path + '/c102/index') 1161 1161 # Customer can submit the form. The form is also saved. 1162 1162 self.browser.getLink("Edit").click() … … 1167 1167 self.assertTrue('Contract State: submitted for approval' in self.browser.contents) 1168 1168 # Customer can't edit the contract once it has been submitted 1169 self.browser.open(self.contracts_path + '/ a102/edit')1169 self.browser.open(self.contracts_path + '/c102/edit') 1170 1170 self.assertTrue('The requested form is locked' in self.browser.contents) 1171 1171 … … 1181 1181 print "Sample PDF overview_slip.pdf written to %s" % path 1182 1182 # Officers can open contract slips 1183 self.browser.open(self.customer_path + '/contracts/ a101')1183 self.browser.open(self.customer_path + '/contracts/c101') 1184 1184 self.browser.getLink("Download contract slip").click() 1185 1185 self.assertEqual(self.browser.headers['Status'], '200 Ok') -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_catalog.py
r12097 r12098 187 187 logcontent = open(logfile).read() 188 188 self.assertTrue( 189 'INFO - system - ObjectRemovedEvent - K1000000 - a101 - removed: product\n'189 'INFO - system - ObjectRemovedEvent - K1000000 - c101 - removed: product\n' 190 190 in logcontent) 191 191 -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/vocabularies.py
r12097 r12098 120 120 121 121 122 class AppCatProductSource(SmartBasicContextualSourceFactory):122 class ConCatProductSource(SmartBasicContextualSourceFactory): 123 123 """An contract category product delivers all products 124 124 which belong to a certain contract_category. 125 125 """ 126 126 def contains(self, context, value): 127 appcat = getattr(context, 'contract_category', None)128 if value.contract_category == appcat:127 concat = getattr(context, 'contract_category', None) 128 if value.contract_category == concat: 129 129 return True 130 130 return False 131 131 132 132 def getValues(self, context): 133 appcat = getattr(context, 'contract_category', None)133 concat = getattr(context, 'contract_category', None) 134 134 products = grok.getSite()['products'].values() 135 if not appcat:135 if not concat: 136 136 return products 137 137 resultlist = [ 138 value for value in products if value.contract_category == appcat]138 value for value in products if value.contract_category == concat] 139 139 return resultlist 140 140 -
main/waeup.ikoba/trunk/src/waeup/ikoba/products/interfaces.py
r12097 r12098 23 23 from waeup.ikoba.interfaces import MessageFactory as _ 24 24 25 class AppCatSource(ContextualDictSourceFactoryBase):25 class ConCatSource(ContextualDictSourceFactoryBase): 26 26 """A contract category source delivers all contract categories 27 27 provided in the portal. 28 28 """ 29 29 #: name of dict to deliver from kofa utils. 30 DICT_NAME = ' APP_CATS_DICT'30 DICT_NAME = 'CON_CATS_DICT' 31 31 32 32 class IProductsContainer(IIkobaObject): … … 57 57 contract_category = schema.Choice( 58 58 title = _(u'Contract Category'), 59 source = AppCatSource(),59 source = ConCatSource(), 60 60 default = u'license', 61 61 required = True, -
main/waeup.ikoba/trunk/src/waeup/ikoba/utils/utils.py
r12092 r12098 102 102 return sorted_phone_prefixes(data, request) 103 103 104 APP_CATS_DICT = {104 CON_CATS_DICT = { 105 105 'sample': 'Sample Category', 106 106 'license': 'License', 107 'no': 'no application',107 'no': 'no contract', 108 108 } 109 109
Note: See TracChangeset for help on using the changeset viewer.