Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions news/SUP-48846.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Change `Applicant` and `Corporation` vocabulary for `persons_titles` to filter singular term
[jchandelle]
8 changes: 7 additions & 1 deletion src/Products/urban/Applicant.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from Products.MasterSelectWidget.MasterBooleanWidget import MasterBooleanWidget
from Products.urban.Contact import Contact
from Products.urban.config import *
from Products.urban.UrbanVocabularyTerm import UrbanVocabulary
from Products.urban.widget.select2widget import MultiSelect2Widget
from plone import api
from zope.interface import implements
Expand Down Expand Up @@ -375,7 +376,12 @@ def finalizeSchema(schema, folderish=False, moveDiscussion=True):
"""
schema.moveField("representedBySociety", after="society")
schema.moveField("isSameAddressAsWorks", after="representedBySociety")

schema["personTitle"].vocabulary = UrbanVocabulary(
"persons_titles",
vocType="PersonTitleTerm",
inUrbanConfig=False,
_filter=lambda title: title["multiplicity"] == "single",
)

finalizeSchema(Applicant_schema)
##/code-section module-footer
5 changes: 4 additions & 1 deletion src/Products/urban/Corporation.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@
i18n_domain="urban",
),
vocabulary=UrbanVocabulary(
"persons_titles", vocType="PersonTitleTerm", inUrbanConfig=False
"persons_titles",
vocType="PersonTitleTerm",
inUrbanConfig=False,
_filter=lambda title: title["multiplicity"] == "single"
),
),
StringField(
Expand Down