Skip to content

Commit

Permalink
URB-2828: Remove covid from optional field
Browse files Browse the repository at this point in the history
  • Loading branch information
jimbiscuit authored and mpeeters committed Dec 18, 2023
1 parent 9c168eb commit c36222e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
2 changes: 2 additions & 0 deletions news/URB-2828.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Remove covid from optional field
[jchandelle]
14 changes: 14 additions & 0 deletions src/Products/urban/migration/update_260.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,17 @@ def add_couple_to_preliminary_notice(context):
setup_tool.runImportStepFromProfile('profile-Products.urban:preinstall', 'typeinfo')
setup_tool.runImportStepFromProfile('profile-Products.urban:preinstall', 'workflow')
logger.info("upgrade step done!")


def remove_covid_from_optional_field(context):
logger = logging.getLogger('urban: Remove covid from optional field')
logger.info("starting upgrade steps")
portal_urban = api.portal.get_tool('portal_urban')
for licence_config in portal_urban.get_all_licence_configs():
used_attributes = licence_config.getUsedAttributes()
if 'covid' not in used_attributes:
continue
licence_config.setUsedAttributes(
tuple(attr for attr in used_attributes if attr != 'covid')
)
logger.info("upgrade step done!")
8 changes: 8 additions & 0 deletions src/Products/urban/migration/upgrades.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -483,4 +483,12 @@
handler=".update_260.add_couple_to_preliminary_notice"
profile="Products.urban:default" />

<gs:upgradeStep
title="Remove covid from optional field"
description="Remove covid from optional field"
source="1131"
destination="1132"
handler=".update_260.remove_covid_from_optional_field"
profile="Products.urban:default" />

</configure>
2 changes: 1 addition & 1 deletion src/Products/urban/profiles/default/metadata.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<metadata>
<version>1131</version>
<version>1132</version>
<dependencies>
<dependency>profile-Products.urban:preinstall</dependency>
</dependencies>
Expand Down

0 comments on commit c36222e

Please sign in to comment.