Conversation
Danielgergely
commented
Feb 26, 2026
- REFACTOR: segmentation data now uses the new model-links
- CHORE: added partner_segment_link to imports
- REFACTOR: removed personalized links and added link_ids
- FEAT: created ResPartnerSegmentLink model
- REFACTOR: added access rules to new model
- REFACTOR: updated partner_segmentation_view to display new links
…d personalized_links - REFACTOR: segmentation data now uses the new model-links - CHORE: added partner_segment_link to imports - REFACTOR: removed personalized links and added link_ids - FEAT: created ResPartnerSegmentLink model - REFACTOR: added access rules to new model - REFACTOR: updated partner_segmentation_view to display new links
Summary of ChangesHello @Danielgergely, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors the management of personalized links within the partner segmentation module. By introducing a dedicated data model for links, it moves away from storing raw HTML, enhancing data integrity, reusability, and maintainability. This change provides a more structured and manageable way to associate useful resources with specific partner segments, allowing for easier localization and administration of these links. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request successfully refactors the personalized links from an HTML field to a structured One2many field, link_ids, which is a significant improvement for data management and flexibility. The new ResPartnerSegmentLink model and its integration into the views and data files are well-implemented. However, there are a few issues related to data migration/consistency and access rights that need attention.
- FIX: added missing links - STYLE: pre-commit - FIX: corrected segmentation link access
|
Related PR for the website: CompassionCH/compassion-website#293 |
- REFACTOR: Created separate links and referenced them in the data objects
ecino
left a comment
There was a problem hiding this comment.
I would be in favor of using translated fields instead of a language field and record duplications.
Also I would take advantage of the new model to allow a little more flexibility (ability to extend to more resources than just URLs)
| <odoo> | ||
| <record |
There was a problem hiding this comment.
This is a clear candidate for noupdate as we don't wan't to maintain the module data while the users could edit the links or the resources from the user interface.
| <odoo> | |
| <record | |
| <odoo> | |
| <data noupdate="1"> | |
| <record |
| url = fields.Char( | ||
| required=True, help="URL of the link to be provided to the partner" | ||
| ) | ||
| label = fields.Char( | ||
| required=True, help="Label of the link to be provided to the partner" | ||
| ) | ||
| language_id = fields.Many2one( | ||
| "res.lang", | ||
| string="Language", | ||
| help="Language of the link, used to provide the link to " | ||
| "the partner based on their language", | ||
| ) |
There was a problem hiding this comment.
Why not using translated fields instead of adding records for every language? Translations should be added in .po files This can greatly simplify the architecture in my opinion:
| url = fields.Char( | |
| required=True, help="URL of the link to be provided to the partner" | |
| ) | |
| label = fields.Char( | |
| required=True, help="Label of the link to be provided to the partner" | |
| ) | |
| language_id = fields.Many2one( | |
| "res.lang", | |
| string="Language", | |
| help="Language of the link, used to provide the link to " | |
| "the partner based on their language", | |
| ) | |
| resource_type = fields.Selection( | |
| [("url", "URL")], | |
| default="url", | |
| required=True, | |
| ) | |
| resource_url = fields.Char( | |
| required=True, | |
| translate=True, | |
| help="URL of the link to be provided to the partner", | |
| ) | |
| label = fields.Char( | |
| required=True, | |
| translate=True, | |
| help="Label of the link to be provided to the partner" | |
| ) |
| from odoo import fields, models | ||
|
|
||
|
|
||
| class ResPartnerSegmentLink(models.Model): |
There was a problem hiding this comment.
I would go beyond just "links" and think broader with this object as a useful "segment resource" available for this segment of donors. Could you please update the model accordingly?
For now we would only have links but why not including files later (documents), images or videos, etc?
| class ResPartnerSegmentLink(models.Model): | |
| class ResPartnerSegmentResource(models.Model): |
| category and language. | ||
| """ | ||
|
|
||
| _name = "res.partner.segment.link" |
There was a problem hiding this comment.
| _name = "res.partner.segment.link" | |
| _name = "res.partner.segment.resource" |
| """ | ||
|
|
||
| _name = "res.partner.segment.link" | ||
| _description = "Partner Segmentation Link" |
There was a problem hiding this comment.
| _description = "Partner Segmentation Link" | |
| _description = "Partner Segmentation Resource" |
|
Put on hold until the partner segmentation is redesigned |