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 (CLASSIQUE) #267

Open
wants to merge 1 commit into
base: urban2.7.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 @@ -246,8 +246,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_270.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,17 @@ def rename_patrimony_certificate(context):
patrimony_config_folder.reindexObject(["Title"])

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 @@ -649,4 +649,13 @@
profile="Products.urban:default"
/>

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