-
Notifications
You must be signed in to change notification settings - Fork 22
feat(translations): add AI translation wizard (initial scaffold) #767 #869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 17.0
Are you sure you want to change the base?
Conversation
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
Summary of ChangesHello @devendra1973, 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 lays the groundwork for an AI-assisted translation feature within the OpenSPP system. It establishes a dedicated module, defines a temporary model to manage translation requests, and integrates the necessary user interface elements for accessibility. The initial setup uses a placeholder for the actual translation process, preparing the system for subsequent integration with external translation services. Highlights
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request provides a solid initial scaffold for the new AI translation wizard module. The structure is logical and follows Odoo conventions. However, I've identified two critical issues that would prevent the module from functioning as intended: an incorrect API decorator in the model and a syntax error in the XML view. Additionally, I've included a medium-severity suggestion to add access control definitions, which is a crucial aspect of security and usability in Odoo applications. Addressing these points will ensure the module is robust and ready for future development.
| @api.model | ||
| def translate_text(self): | ||
| # Simple placeholder logic (we fake translation for now) | ||
| self.translated_text = f"TRANSLATED: {self.source_text}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The @api.model decorator is used incorrectly here. This method is intended to be called on a specific record of the wizard, so it should be an instance method. With @api.model, self becomes a class proxy, not a record instance, and accessing self.source_text would fail. Removing the decorator will make it a regular instance method, which is the correct approach here. I've also added self.ensure_one() as a good practice for instance methods to ensure they operate on a single record.
| @api.model | |
| def translate_text(self): | |
| # Simple placeholder logic (we fake translation for now) | |
| self.translated_text = f"TRANSLATED: {self.source_text}" | |
| def translate_text(self): | |
| self.ensure_one() | |
| # Simple placeholder logic (we fake translation for now) | |
| self.translated_text = f"TRANSLATED: {self.source_text}" |
| <menuitem id="menu_translation_root" name="Translation" sequence="10"/> | ||
| <menuitem id="menu_translation_tool" name="AI Translator" parent="menu_translation_root" action="action_translation_wizard"/> | ||
| </odoo> | ||
| o |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 'data': [ | ||
| 'views/translation_wizard_view.xml', | ||
| ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new model translation.wizard is missing access rights. Without an ir.model.access.csv file, only the superuser will be able to access this wizard. It's a security best practice in Odoo to explicitly define access rights for all models. I recommend creating a security/ir.model.access.csv file for the translation.wizard model and adding it to the data list in this manifest file. This will ensure that users with the appropriate permissions can use the translation tool.
| 'data': [ | |
| 'views/translation_wizard_view.xml', | |
| ], | |
| 'data': [ | |
| 'security/ir.model.access.csv', | |
| 'views/translation_wizard_view.xml', | |
| ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the final PR Bugbot will review for you during this billing cycle
Your free Bugbot reviews will reset on November 17
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| @api.model | ||
| def translate_text(self): | ||
| # Simple placeholder logic (we fake translation for now) | ||
| self.translated_text = f"TRANSLATED: {self.source_text}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Decorator blocks instance access
The translate_text method uses @api.model decorator but accesses instance fields self.source_text and self.translated_text. When called from a button with type="object", the method receives a recordset but @api.model doesn't bind self to the record properly, causing the translation to fail. The decorator should be removed or changed to allow instance access.
| <menuitem id="menu_translation_root" name="Translation" sequence="10"/> | ||
| <menuitem id="menu_translation_tool" name="AI Translator" parent="menu_translation_root" action="action_translation_wizard"/> | ||
| </odoo> | ||
| o |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|



Summary
Implemented AI-assisted translation wizard for OpenSPP.
Changes Included:
openspp_translationstranslation_wizard.pytranslation_wizard_view.xmlTesting
Successfully tested module installation and UI load in Odoo 17 (local environment).
@openspp-maintainers kindly review 🙏