diff --git a/themis/search/indexer.py b/themis/search/indexer.py index af45226..15bc32f 100644 --- a/themis/search/indexer.py +++ b/themis/search/indexer.py @@ -311,3 +311,20 @@ def personsStrIndexer(obj): return ', '.join(get_doc_persons(obj)) grok.global_adapter(personsStrIndexer, name='docPersonsStr') + +@indexer(plone.dexterity.interfaces.IDexterityItem) +def statusTitleIndexer(obj): + if obj.portal_type not in ('courrier_entrant', 'courrier_sortant'): + if not '(D)' in obj.Type(): + return None + + portal_workflow = getToolByName(obj, 'portal_workflow') + + current_state = portal_workflow.getStatusOf( + portal_workflow.getChainFor(obj)[0], obj).get('review_state') + for label, id in portal_workflow.listWFStatesByTitle(): + if current_state == id: + return label + return current_state +grok.global_adapter(statusTitleIndexer, name='statusTitle') + diff --git a/themis/search/profiles/default/catalog.xml b/themis/search/profiles/default/catalog.xml index efba80e..f06c687 100644 --- a/themis/search/profiles/default/catalog.xml +++ b/themis/search/profiles/default/catalog.xml @@ -73,4 +73,5 @@ +