Ignore:
Timestamp:
3 Dec 2014, 18:09:28 (10 years ago)
Author:
Henrik Bettermann
Message:

When checking conversion during import, contracts do not belong to
customers. Thus all portal documents must be returned by getValues.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/vocabularies.py

    r12101 r12127  
    2626from zc.sourcefactory.basic import BasicSourceFactory
    2727from zc.sourcefactory.contextual import BasicContextualSourceFactory
     28from waeup.ikoba.sourcefactory import SmartBasicContextualSourceFactory
    2829from waeup.ikoba.interfaces import SimpleIkobaVocabulary, SUBMITTED, VERIFIED
    2930from waeup.ikoba.interfaces import MessageFactory as _
     
    145146
    146147    def getValues(self, context):
    147         documents = context.customer['documents'].values()
     148        # When checking conversion during import, contracts do not belong to
     149        # customers. Thus all portal documents must be returned.
     150        user_id = getattr(getattr(context, 'customer', None), 'user_id', None)
     151        catalog = getUtility(ICatalog, name='documents_catalog')
     152        results = catalog.searchResults(user_id=(user_id, user_id))
    148153        resultlist = [
    149             value for value in documents if value.state in (SUBMITTED, VERIFIED)]
     154            value for value in results if value.state in (SUBMITTED, VERIFIED)]
    150155        return resultlist
    151156
Note: See TracChangeset for help on using the changeset viewer.