diff --git a/news/SUP-33621.bugfix b/news/SUP-33621.bugfix
new file mode 100644
index 000000000..167bc4ace
--- /dev/null
+++ b/news/SUP-33621.bugfix
@@ -0,0 +1,2 @@
+Allow corporate tenant in inspections
+[daggelpop]
\ No newline at end of file
diff --git a/src/Products/urban/content/licence/Inspection.py b/src/Products/urban/content/licence/Inspection.py
index 6862c1183..36b7749ac 100644
--- a/src/Products/urban/content/licence/Inspection.py
+++ b/src/Products/urban/content/licence/Inspection.py
@@ -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):
diff --git a/src/Products/urban/migration/update_270.py b/src/Products/urban/migration/update_270.py
index f5a9b0d35..e9c05109b 100644
--- a/src/Products/urban/migration/update_270.py
+++ b/src/Products/urban/migration/update_270.py
@@ -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!")
diff --git a/src/Products/urban/migration/upgrades.zcml b/src/Products/urban/migration/upgrades.zcml
index 7829b104a..cf84dff77 100644
--- a/src/Products/urban/migration/upgrades.zcml
+++ b/src/Products/urban/migration/upgrades.zcml
@@ -649,4 +649,13 @@
profile="Products.urban:default"
/>
+
+
diff --git a/src/Products/urban/profiles/default/metadata.xml b/src/Products/urban/profiles/default/metadata.xml
index af59da615..cf1914309 100644
--- a/src/Products/urban/profiles/default/metadata.xml
+++ b/src/Products/urban/profiles/default/metadata.xml
@@ -1,6 +1,6 @@
- 1150
+ 1151
profile-Products.urban:preinstall