Conversation
Danielgergely
commented
Feb 18, 2026
- FEATURE: added is_translator check to my_compassion/res_partner
- FIX: changed partner._is_volunteer check to partner._is_translator
…f user is a translator - FEATURE: added is_translator check to my_compassion/res_partner - FIX: changed partner._is_volunteer check to partner._is_translator
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 refines the logic for displaying the 'translate letter' button on the user dashboard. It introduces a dedicated mechanism to identify translators, ensuring that the button is presented exclusively to users who are assigned translator roles, thereby improving the accuracy of UI element visibility based on user permissions. 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
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
This pull request introduces a new computed field is_translator on the res.partner model to identify partners who are translators. This field is then used in the dashboard template to conditionally display a 'Translate a letter' button, ensuring it's only visible to translators. The changes are logical and correctly implement the intended feature. I have one suggestion to improve the type hinting in the new Python method for consistency with Odoo's conventions.
my_compassion/models/res_partner.py
Outdated
| Compute whether the partner is a translator | ||
| """ | ||
| for partner in self: | ||
| partner.is_translator = bool(partner.translation_user_id) |
There was a problem hiding this comment.
Building a compute field on top on a compute field seems not optimal to me, also, translation_user_id is declared in another module, that is not a dependency of my_compassion, which can result in an error in some cases.
A simple trick to make the call safe here would be to do this
| partner.is_translator = bool(partner.translation_user_id) | |
| partner.is_translator = bool(getattr(partner, 'translation_user_id', False)) |
But this kind of reverse dependency is dirty.
The correct approach in my opinion would be to move this logic in my_compassion_switzerland, giving the responsibility to it to inject the Volunteer xml vignette and the logic that follows with showing the button when the volunteer is a translator.
There was a problem hiding this comment.
@NoeBerdoz I removed the translate letter button and added it to the compassion 2025 theme. Here is the new PR: CompassionCH/compassion-switzerland#1745
# Conflicts: # my_compassion/templates/pages/my2_dashboard.xml