Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SUP-33621: Allow corporate tenant in inspections (LIEGE) #268

Open
wants to merge 1 commit into
base: liege-urban2.5.x
Choose a base branch
from
Open
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-33621.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Allow corporate tenant in inspections
[daggelpop]
12 changes: 12 additions & 0 deletions src/Products/urban/content/licence/Inspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,20 @@ def getTenants(self):
tenants = [
app for app in self.objectValues("Applicant") if app.portal_type == "Tenant"
]
corporations = self.getCorporationTenants()
tenants.extend(corporations)
return tenants

security.declarePublic("getCorporationTenants")

def getCorporationTenants(self):
corporations = [
corp
for corp in self.objectValues("Corporation")
if corp.portal_type == "CorporationTenant"
]
return corporations

security.declarePublic("getPlaintiffs")

def getPlaintiffs(self):
Expand Down
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 @@ -21,3 +21,17 @@ def update_delais_vocabularies_and_activate_prorogation_field(context):
to_set = ("prorogation",)
config.setUsedAttributes(config.getUsedAttributes() + to_set)
logger.info("upgrade step done!")


def allow_corporate_tenant_in_inspections(context):
""" """
logger = logging.getLogger("urban: Allow corporate tenant in inspections")
logger.info("starting upgrade steps")

portal_types_tool = api.portal.get_tool("portal_types")
isp_tool = portal_types_tool.get("Inspection")
if "CorporationTenant" not in isp_tool.allowed_content_types:
new_allowed_types = list(isp_tool.allowed_content_types) + ["CorporationTenant"]
isp_tool.allowed_content_types = tuple(new_allowed_types)

logger.info("upgrade step done!")
9 changes: 9 additions & 0 deletions src/Products/urban/migration/upgrades.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,13 @@
profile="Products.urban:default"
/>

<gs:upgradeStep
title="Allow corporate tenant in inspections"
description=""
source="1141"
destination="1142"
handler=".update_260.allow_corporate_tenant_in_inspections"
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>1141</version>
<version>1142</version>
<dependencies>
<dependency>profile-Products.urban:preinstall</dependency>
</dependencies>
Expand Down