Changeset 14215 for main/waeup.ikoba/trunk
- Timestamp:
- 19 Oct 2016, 09:48:38 (8 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba/customers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser.py
r14208 r14215 1290 1290 # classes depending on the contype parameter given in form. 1291 1291 contract = createObject('waeup.%s' % contype) 1292 # Check whether there are active products for this contract. 1293 concat = getattr(contract, 'contract_category', None) 1294 products = grok.getSite()['products'].values() 1295 active_products = [ 1296 value for value in products 1297 if value.contract_category == concat and value.active 1298 ] 1299 if not len(active_products): 1300 self.flash(_('No active products in this category.'), type='warning') 1301 self.redirect(self.url(self.context)) 1302 return 1292 1303 self.context.addContract(contract) 1293 1304 contype = getUtility(ICustomersUtils).SELECTABLE_CONTYPES_DICT[contype] -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py
r14208 r14215 1350 1350 self.browser.getControl("Add contract").click() 1351 1351 self.browser.getControl(name="contype").value = ['SampleContract'] 1352 # No active product 1353 self.product.valid_to = date(2014, 12, 4) 1354 self.browser.getControl("Add contract").click() 1355 self.assertTrue('No active products in this category.' 1356 in self.browser.contents) 1357 self.product.valid_to = date(2050, 12, 4) 1358 self.browser.getControl("Add contract").click() 1359 self.browser.getControl(name="contype").value = ['SampleContract'] 1352 1360 self.browser.getControl("Add contract").click() 1353 1361 self.assertTrue('Sample Contract added.' in self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.