[FIX] base_dynamic_message: Add unique field descriptions to avoid warnings#269
Closed
ced-adhoc wants to merge 1 commit intoingadhoc:18.0from
Closed
[FIX] base_dynamic_message: Add unique field descriptions to avoid warnings#269ced-adhoc wants to merge 1 commit intoingadhoc:18.0from
ced-adhoc wants to merge 1 commit intoingadhoc:18.0from
Conversation
Contributor
vib-adhoc
reviewed
Aug 29, 2025
Comment on lines
+9
to
+27
| fields_to_update = env["ir.model.fields"].search( | ||
| [ | ||
| ("field_description", "=like", "Dynamic Message%"), | ||
| ("name", "=like", "x_dynamic_message_%"), | ||
| ("field_description", "not ilike", "Dynamic Message %"), # Exclude those already with ID | ||
| ] | ||
| ) | ||
|
|
||
| for field in fields_to_update: | ||
| # Extract the ID from the field name (x_dynamic_message_123 -> 123) | ||
| if field.name.startswith("x_dynamic_message_"): | ||
| try: | ||
| dynamic_message_id = field.name.split("_")[-1] | ||
| if dynamic_message_id.isdigit(): | ||
| new_description = "Dynamic Message %s" % dynamic_message_id | ||
| field.write({"field_description": new_description}) | ||
| except (IndexError, ValueError): | ||
| # Skip if we can't extract a valid ID | ||
| continue |
Contributor
There was a problem hiding this comment.
Suggested change
| fields_to_update = env["ir.model.fields"].search( | |
| [ | |
| ("field_description", "=like", "Dynamic Message%"), | |
| ("name", "=like", "x_dynamic_message_%"), | |
| ("field_description", "not ilike", "Dynamic Message %"), # Exclude those already with ID | |
| ] | |
| ) | |
| for field in fields_to_update: | |
| # Extract the ID from the field name (x_dynamic_message_123 -> 123) | |
| if field.name.startswith("x_dynamic_message_"): | |
| try: | |
| dynamic_message_id = field.name.split("_")[-1] | |
| if dynamic_message_id.isdigit(): | |
| new_description = "Dynamic Message %s" % dynamic_message_id | |
| field.write({"field_description": new_description}) | |
| except (IndexError, ValueError): | |
| # Skip if we can't extract a valid ID | |
| continue | |
| fields_to_update = env["ir.model.fields"].search([("field_description", "=", "Dynamic Message")]) | |
| for field in fields_to_update: | |
| field.write({"field_description": "Dynamic Message %s" % field.id}) |
Contributor
|
@ced-adhoc Hola Celi, te dejé una sugerencia para simplificar el script, decime qué te parece o lo podemos charlar esta tarde. No lo probé, es solo una sugerencia |
b3b6182 to
5685ddd
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR adds unique field descriptions to dynamic message fields to prevent Odoo warnings about duplicate field descriptions. Instead of all dynamic message fields having the generic "Dynamic Message" description, they now include their record ID to create unique descriptions.
- Updates field creation logic to include record ID in field descriptions
- Adds migration script to update existing fields with generic descriptions
- Version bump to support the migration
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| base_dynamic_message/models/ir_model_dynamic_message.py | Updates field description format to include record ID |
| base_dynamic_message/migrations/18.0.1.1.0/post-migration.py | Migration script to update existing fields with generic descriptions |
| base_dynamic_message/manifest.py | Version bump to trigger migration |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
5685ddd to
a324910
Compare
Contributor
|
@roboadhoc r+ |
roboadhoc
pushed a commit
that referenced
this pull request
Oct 8, 2025
…rnings closes #269 Signed-off-by: Virginia Bonservizi <vib@adhoc.com.ar>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This prevents warnings about duplicate field descriptions by making each dynamic message field have a unique description like "Dynamic Message 1", "Dynamic Message 2", etc.