diff --git a/news/SUP-40522.feature b/news/SUP-40522.feature
new file mode 100644
index 000000000..4fedefcf0
--- /dev/null
+++ b/news/SUP-40522.feature
@@ -0,0 +1,2 @@
+Migrate `rgbsr` field to multiple lines
+[daggelpop]
\ No newline at end of file
diff --git a/src/Products/urban/content/licence/GenericLicence.py b/src/Products/urban/content/licence/GenericLicence.py
index a70ae413b..d989c7a03 100755
--- a/src/Products/urban/content/licence/GenericLicence.py
+++ b/src/Products/urban/content/licence/GenericLicence.py
@@ -1067,9 +1067,9 @@
schemata="urban_location",
default_output_type="text/x-html-safe",
),
- StringField(
+ LinesField(
name="rgbsr",
- widget=SelectionWidget(
+ widget=MultiSelect2Widget(
label=_("urban_label_rgbsr", default="Rgbsr"),
),
schemata="urban_location",
diff --git a/src/Products/urban/migration/update_270.py b/src/Products/urban/migration/update_270.py
index a8f2e7b21..fdc653830 100644
--- a/src/Products/urban/migration/update_270.py
+++ b/src/Products/urban/migration/update_270.py
@@ -2,6 +2,7 @@
from Acquisition import aq_parent
from OFS.interfaces import IOrderedContainer
+from Products.urban.interfaces import IGenericLicence
from Products.urban.migration.utils import refresh_workflow_permissions
from imio.schedule.content.object_factories import MacroCreationConditionObject
from imio.schedule.content.object_factories import MacroEndConditionObject
@@ -28,6 +29,7 @@
from zope.component import getMultiAdapter
import logging
+import six
def rename_patrimony_certificate(context):
@@ -213,3 +215,26 @@ def fix_config_wrong_class(context):
schedule_cfg.REQUEST.form = data
logger.info("Upgrade step done!")
+
+
+def migrate_rgbsr_multiple_lines(context):
+ """
+ Migrate rgbsr field from StringField to LinesField
+ """
+ logger = logging.getLogger("Migrate rgbsr field to multiple lines")
+ logger.info("starting upgrade steps")
+
+ catalog = api.portal.get_tool("portal_catalog")
+ licence_brains = catalog(object_provides=IGenericLicence.__identifier__)
+
+ for brain in licence_brains:
+ licence = brain.getObject()
+
+ if not hasattr(licence, "rgbsr") or licence.rgbsr is None or type(licence.rgbsr) is tuple:
+ continue
+
+ if isinstance(licence.rgbsr, six.string_types):
+ new_value = () if not licence.rgbsr else (licence.rgbsr,)
+ licence.setRgbsr(new_value)
+
+ logger.info("Upgrade step done!")
diff --git a/src/Products/urban/migration/upgrades.zcml b/src/Products/urban/migration/upgrades.zcml
index b70548de7..39d454de8 100644
--- a/src/Products/urban/migration/upgrades.zcml
+++ b/src/Products/urban/migration/upgrades.zcml
@@ -693,4 +693,13 @@
profile="Products.urban:default"
/>
+
+
diff --git a/src/Products/urban/profiles/default/metadata.xml b/src/Products/urban/profiles/default/metadata.xml
index 5723dd3e0..0b75a30cf 100644
--- a/src/Products/urban/profiles/default/metadata.xml
+++ b/src/Products/urban/profiles/default/metadata.xml
@@ -1,6 +1,6 @@
- 1155
+ 1156
profile-Products.urban:preinstall