Changeset 14202
- Timestamp:
- 29 Sep 2016, 06:51:42 (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/tests/test_batching.py
r12986 r14202 154 154 contract = createObject('waeup.SampleContract') 155 155 contract.contract_id = u'CON1' 156 customer['contracts'].addContract(contract) 156 157 contract.product_object = self.product 157 158 contract.document_object = self.document … … 160 161 contract.valid_from = datetime.date(2014, 2, 4) 161 162 contract.valid_to = datetime.date(2014, 12, 4) 162 163 customer['contracts'].addContract(contract)164 163 self.contract = contract 165 164 return customer … … 535 534 def test_import_update(self): 536 535 # We perform the same import twice, 537 # the second time in update mode. The number 538 # of warnings must be the same. 536 # the second time in update mode. No record can be imported. 539 537 num, num_warns, fin_file, fail_file = self.processor.doImport( 540 538 self.csv_file, CONTRACT_HEADER_FIELDS,'create') … … 544 542 # There are one record without contract_id and two 545 543 # records with wrong object identifier. 546 self.assertEqual(num_warns,3) 544 # The other 4 records cannot be imported because DOC1 does 545 # not belong to these customers. 546 self.assertEqual(num_warns,7) 547 547 shutil.rmtree(os.path.dirname(fin_file)) 548 548 -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/vocabularies.py
r12839 r14202 182 182 183 183 def getValues(self, context): 184 # When checking conversion during import, contracts do not belong to 185 # customers. Thus all portal documents must be returned. 186 user_id = getattr(getattr(context, 'customer', None), 'user_id', None) 184 # When checking conversion during import in create mode, 185 # contracts do not belong to customers. 186 # Thus all portal documents must be returned. 187 # Attention: In create mode documents of other customers 188 # can be assigned. ConstraintNotSatisfied is not raised. 189 user_id = getattr(context, 'user_id', None) 190 # Alternative implementation: 191 #if not user_id: 192 # return [] 187 193 catalog = getUtility(ICatalog, name='documents_catalog') 188 194 results = catalog.searchResults(user_id=(user_id, user_id))
Note: See TracChangeset for help on using the changeset viewer.