Skip to content

Commit

Permalink
Add upgrade step for PrenotazioniFolder.max_bookings_allowed = 2 fiel…
Browse files Browse the repository at this point in the history
…d default value
  • Loading branch information
folix-01 committed Oct 4, 2023
1 parent 6a26472 commit 040d59e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/redturtle/prenotazioni/profiles/default/metadata.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<version>1803</version>
<version>1804</version>
<dependencies>
<dependency>profile-plone.app.dexterity:default</dependency>
<dependency>profile-collective.z3cform.datagridfield:default</dependency>
Expand Down
8 changes: 8 additions & 0 deletions src/redturtle/prenotazioni/upgrades.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,3 +398,11 @@ def update_booking_code(self):
logger.info(
f"- [{brain.getPath()}] set booking_code to {item.booking_code}"
)


def to_1804(self):
for brain in api.portal.get_tool("portal_catalog")(
portal_type="PrenotazioniFolder"
):
logger.info("Updating <{UID}>.max_bookings_allowed=2".format(UID=brain.UID))
brain.getObject().max_bookings_allowed = 2
10 changes: 10 additions & 0 deletions src/redturtle/prenotazioni/upgrades.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,14 @@
handler=".upgrades.update_rolemap"
/>
</genericsetup:upgradeSteps>
<genericsetup:upgradeSteps
profile="redturtle.prenotazioni:default"
source="1803"
destination="1804"
>
<genericsetup:upgradeStep
title="Set up PrenotazioniFolder.max_bookings_allowed default value(2)"
handler=".upgrades.to_1804"
/>
</genericsetup:upgradeSteps>
</configure>

0 comments on commit 040d59e

Please sign in to comment.