Skip to content

T3022 partner segmentation refactor#2081

Open
Danielgergely wants to merge 6 commits into14.0from
T3022-partner-segmentation-refactor
Open

T3022 partner segmentation refactor#2081
Danielgergely wants to merge 6 commits into14.0from
T3022-partner-segmentation-refactor

Conversation

@Danielgergely
Copy link
Copy Markdown
Member

  • 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
image

…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
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @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

  • Data Model Refactor: The personalized_links HTML field in res.partner.segment has been replaced with a structured link_ids One2many field, linking to a new dedicated model.
  • New Model Introduced: A new model, ResPartnerSegmentLink, was created to store individual link details including URL, label, and associated language and category.
  • Data Migration: Existing personalized links in partner_segmentation_data.xml were migrated from raw HTML to the new structured link_ids format.
  • Access Control: Access rules were added for the new ResPartnerSegmentLink model to ensure proper permissions.
  • UI Update: The partner segmentation view was updated to display the new link_ids field using an editable tree widget.

🧠 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
  • partner_segmentation/data/partner_segmentation_data.xml
    • Replaced the personalized_links field with link_ids and updated the data to use the new structured link format for various partner segments.
  • partner_segmentation/models/init.py
    • Added partner_segment_link to the list of imported modules.
  • partner_segmentation/models/partner_segment.py
    • Removed the personalized_links HTML field.
    • Added a link_ids One2many field to res.partner.segment.link to manage structured personalized links.
  • partner_segmentation/models/partner_segment_link.py
    • Created a new model ResPartnerSegmentLink to define structured links with fields for URL, label, language, and category.
  • partner_segmentation/security/ir.model.access.csv
    • Added access rules for the new res.partner.segment.link model, granting full access to base.group_user.
  • partner_segmentation/views/partner_segmentation_view.xml
    • Replaced the personalized_links field in the form view with the new link_ids field, displayed as an editable tree with columns for label, URL, and language.
Activity
  • The author refactored segmentation data to utilize the newly introduced model-links.
  • The partner_segment_link module was added to the imports.
  • The personalized_links field was removed and replaced with link_ids across relevant files.
  • A new model, ResPartnerSegmentLink, was created to handle structured link data.
  • Access rules were implemented for the new ResPartnerSegmentLink model.
  • The partner_segmentation_view was updated to correctly display the new link structure.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

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
@Danielgergely
Copy link
Copy Markdown
Member Author

Related PR for the website: CompassionCH/compassion-website#293

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.

1 participant