Skip to content

URBBDC-3225: feature configurable houssing subject#565

Open
WBoudabous wants to merge 5 commits into
2.9.xfrom
URBBDC-3225_feature_configurable_houssing_subject
Open

URBBDC-3225: feature configurable houssing subject#565
WBoudabous wants to merge 5 commits into
2.9.xfrom
URBBDC-3225_feature_configurable_houssing_subject

Conversation

@WBoudabous

@WBoudabous WBoudabous commented May 22, 2026

Copy link
Copy Markdown
Contributor

This pull request adds the possibility to configure the dossier subject automatically via configurable title formatting for housing, division and urban certificate dossiers.

Summary by CodeRabbit

  • New Features

    • Users can now configure custom titles for housing, divisions, and urban certificates in system settings.
    • When configured, custom titles automatically replace default title formatting.
    • All existing records have been updated to support the new title configuration capability.
  • Improvements

    • Added French language support for custom title configuration labels.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 22, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The pull request introduces configurable custom title formatting for three license object types (Housing, Division, CODT_UrbanCertificateBase). A new customTitle field is added to LicenceConfig, and a private helper method in GenericLicence evaluates and applies custom titles with reindexing. License subclasses override updateTitle() to attempt custom title application before falling back to standard logic. A migration handler and upgrade step propagate title updates to existing objects during the 2913→2914 version transition, and French localization is provided.

Changes

Custom Title Configuration and Application

Layer / File(s) Summary
Feature specification and schema definition
news/URBBDC-3225.feature, src/Products/urban/LicenceConfig.py
Feature describes configurable title formatting for Housing, Division, and CODT_UrbanCertificate; LicenceConfig schema adds new customTitle StringField with i18n label and public settings assignment.
Custom title application in license classes
src/Products/urban/content/licence/GenericLicence.py, src/Products/urban/content/licence/Housing.py, src/Products/urban/content/licence/Division.py, src/Products/urban/content/licence/CODT_UrbanCertificateBase.py
GenericLicence defines _apply_custom_title() to retrieve and apply custom title from config with reindexing; Housing, Division, and CODT_UrbanCertificateBase override updateTitle() to conditionally apply custom titles before delegating to parent implementation.
Data migration and upgrade orchestration
src/Products/urban/migration/update_290.py, src/Products/urban/migration/upgrades_290.zcml, src/Products/urban/profiles/default/metadata.xml
Migration function update_custom_titles() queries catalog for three license types and calls updateTitle() on each matched object; ZCML upgrade step registers the handler for 2913→2914 transition; profile version incremented to 2914.
French translation support
src/Products/urban/locales/fr/LC_MESSAGES/urban.po
New gettext entry for urban_label_customTitle mapped to French label "Libellé personnalisé".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • mpeeters

Poem

🐰 A custom title blooms so fair,
Where Housing, Division dance with care,
Config guides the label's flight,
Reindexed bright in catalog's light,
Admin joy—no hardcoding blight! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title mentions 'houssing subject' but the PR implements configurable title formatting for three types of licenses (housing, division, and urban certificate), not just housing. The title is partially related but incomplete and contains a typo ('houssing' instead of 'housing'). Consider revising the title to reflect all three license types affected, for example: 'URBBDC-3225: Add configurable title formatting for housing, division, and urban certificate' and fix the spelling of 'housing'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch URBBDC-3225_feature_configurable_houssing_subject

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@news/URBBDC-3225.feature`:
- Line 1: Update the feature note text that currently contains the typo "urbanc
ertificate" to read "urban certificate"; locate the title/description line in
the URBBDC-3225.feature content where "Introduce configurable title formatting
for housing, division and urbanc ertificate" appears and correct that phrase to
"Introduce configurable title formatting for housing, division and urban
certificate".

In `@src/Products/urban/content/licence/GenericLicence.py`:
- Around line 1569-1573: When applying a custom title in GenericLicence.py (the
block using licence_config.getCustomTitle(), self.setTitle(custom_title), and
self.reindexObject(...)), ensure the catalog reindex mirrors the legacy path by
including the applicantInfosIndex; update the reindexObject call to reindex
"Title", "sortable_title" and "applicantInfosIndex" so applicant-related catalog
data stays in sync when updateTitle() takes the custom-title branch.

In `@src/Products/urban/migration/upgrades_290.zcml`:
- Line 112: Fix the typo in the upgrade step title attribute: change the title
value that currently reads "Update titles for Housing, Division and
Urbanncertificate" to "Update titles for Housing, Division and UrbanCertificate"
by updating the title="..." attribute on the upgrade-step (or related element)
so the "Urbanncertificate" token is corrected to "UrbanCertificate".
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 617655c0-9a03-4554-9aef-0828c9ae7fae

📥 Commits

Reviewing files that changed from the base of the PR and between 5313a61 and 691ab0b.

📒 Files selected for processing (10)
  • news/URBBDC-3225.feature
  • src/Products/urban/LicenceConfig.py
  • src/Products/urban/content/licence/CODT_UrbanCertificateBase.py
  • src/Products/urban/content/licence/Division.py
  • src/Products/urban/content/licence/GenericLicence.py
  • src/Products/urban/content/licence/Housing.py
  • src/Products/urban/locales/fr/LC_MESSAGES/urban.po
  • src/Products/urban/migration/update_290.py
  • src/Products/urban/migration/upgrades_290.zcml
  • src/Products/urban/profiles/default/metadata.xml

Comment thread news/URBBDC-3225.feature
@@ -0,0 +1,2 @@
Introduce configurable title formatting for housing, division and urbanc ertificate

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix typo in the feature note.

urbanc ertificate should be urban certificate.

Proposed fix
-Introduce configurable title formatting for housing, division and urbanc ertificate
+Introduce configurable title formatting for housing, division and urban certificate
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Introduce configurable title formatting for housing, division and urbanc ertificate
Introduce configurable title formatting for housing, division and urban certificate
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@news/URBBDC-3225.feature` at line 1, Update the feature note text that
currently contains the typo "urbanc ertificate" to read "urban certificate";
locate the title/description line in the URBBDC-3225.feature content where
"Introduce configurable title formatting for housing, division and urbanc
ertificate" appears and correct that phrase to "Introduce configurable title
formatting for housing, division and urban certificate".

Comment thread src/Products/urban/content/licence/GenericLicence.py
profile="Products.urban:default" />

<gs:upgradeStep
title="Update titles for Housing, Division and Urbanncertificate"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix typo in upgrade-step title.

Urbanncertificate should be UrbanCertificate.

Proposed fix
-        title="Update titles for Housing, Division and Urbanncertificate"
+        title="Update titles for Housing, Division and UrbanCertificate"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
title="Update titles for Housing, Division and Urbanncertificate"
title="Update titles for Housing, Division and UrbanCertificate"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Products/urban/migration/upgrades_290.zcml` at line 112, Fix the typo in
the upgrade step title attribute: change the title value that currently reads
"Update titles for Housing, Division and Urbanncertificate" to "Update titles
for Housing, Division and UrbanCertificate" by updating the title="..."
attribute on the upgrade-step (or related element) so the "Urbanncertificate"
token is corrected to "UrbanCertificate".

@WBoudabous WBoudabous requested a review from mpeeters May 22, 2026 13:02
Comment thread news/URBBDC-3225.feature
@@ -0,0 +1,2 @@
Introduce configurable title formatting for housing, division and urbanc ertificate

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix typo mentioned by coderabbit


def update_custom_titles(context):
catalog = api.portal.get_tool("portal_catalog")
brains = catalog(portal_type=["Housing", "Division","CODT_UrbanCertificateBase"])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use plone.api.content.find instead

brains = catalog(portal_type=["Housing", "Division","CODT_UrbanCertificateBase"])
for brain in brains:
obj = brain.getObject()
obj.updateTitle()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing blank lines and your code should be the latest migration.

profile="Products.urban:default" />

<gs:upgradeStep
title="Update titles for Housing, Division and Urbanncertificate"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix typo Urbanncertificate -> UrbanCertificate

StringField(
name="customTitle",
widget=StringField._properties["widget"](
size=100,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a description to specify that this field will be only useful for Housing, Division, CODT_UrbanCertificateBase


return config_folder

def _apply_custom_title(self):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method will introduce duplicate titles because all licences will have exactly the same one.

logger.info("manageableLicences updated for notice FolderManager")


def update_custom_titles(context):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method will no do anything because the licences configs are not updated before.

@mpeeters

Copy link
Copy Markdown
Member

Please fix the conflict as well

@mpeeters mpeeters changed the title Urbbdc 3225 feature configurable houssing subject URBBDC-3225: feature configurable houssing subject Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants