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 02b25e26f..9f1985a47 100644 --- a/src/Products/urban/content/licence/Inspection.py +++ b/src/Products/urban/content/licence/Inspection.py @@ -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): diff --git a/src/Products/urban/migration/update_260.py b/src/Products/urban/migration/update_260.py index 1f247b693..408c97a66 100644 --- a/src/Products/urban/migration/update_260.py +++ b/src/Products/urban/migration/update_260.py @@ -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!") diff --git a/src/Products/urban/migration/upgrades.zcml b/src/Products/urban/migration/upgrades.zcml index b13876f13..7fefbd42b 100644 --- a/src/Products/urban/migration/upgrades.zcml +++ b/src/Products/urban/migration/upgrades.zcml @@ -208,4 +208,13 @@ profile="Products.urban:default" /> + + diff --git a/src/Products/urban/profiles/default/metadata.xml b/src/Products/urban/profiles/default/metadata.xml index a3526fdf7..c0a22c909 100644 --- a/src/Products/urban/profiles/default/metadata.xml +++ b/src/Products/urban/profiles/default/metadata.xml @@ -1,6 +1,6 @@ - 1141 + 1142 profile-Products.urban:preinstall