-
Notifications
You must be signed in to change notification settings - Fork 23
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # OpenSPP Translations (AI Assisted Translation Wizard) | ||
|
|
||
| This module introduces a basic translation wizard that allows users to input | ||
| source text and generate translated output (stub implementation for now). | ||
| A follow-up iteration will integrate real translation providers. | ||
|
|
||
| - Wizard model: `translation.wizard` | ||
| - View: Form and menu entry under "Translations" | ||
| - Status: Scaffolding ready, awaiting integration with external providers. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| 'name': 'OpenSPP Translations', | ||
| 'version': '1.0', | ||
| 'summary': 'AI-assisted translation tool for OpenSPP', | ||
| 'depends': ['base'], | ||
| 'data': [ | ||
| 'views/translation_wizard_view.xml', | ||
| ], | ||
| 'installable': True, | ||
| 'application': False, | ||
| } | ||
|
|
||
|
|
||
| 'license': 'LGPL-3', | ||
| 'author': 'Devendra Chauhan', | ||
| 'website': 'https://github.com/devendra1973', | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| from . import translation_wizard |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,13 @@ | ||||||||||||||||||
| from odoo import models, fields, api | ||||||||||||||||||
|
|
||||||||||||||||||
| class TranslationWizard(models.TransientModel): | ||||||||||||||||||
| _name = 'translation.wizard' | ||||||||||||||||||
| _description = 'AI-Assisted Translation Wizard' | ||||||||||||||||||
|
|
||||||||||||||||||
| source_text = fields.Text("Source Text", required=True) | ||||||||||||||||||
| translated_text = fields.Text("Translated Text") | ||||||||||||||||||
|
|
||||||||||||||||||
| @api.model | ||||||||||||||||||
| def translate_text(self): | ||||||||||||||||||
| # Simple placeholder logic (we fake translation for now) | ||||||||||||||||||
| self.translated_text = f"TRANSLATED: {self.source_text}" | ||||||||||||||||||
|
Comment on lines
+10
to
+13
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Decorator blocks instance accessThe |
||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| <odoo> | ||
| <record id="view_translation_wizard" model="ir.ui.view"> | ||
| <field name="name">translation.wizard.form</field> | ||
| <field name="model">translation.wizard</field> | ||
| <field name="arch" type="xml"> | ||
| <form string="AI Translation Tool"> | ||
| <group> | ||
| <field name="source_text"/> | ||
| <field name="translated_text" readonly="1"/> | ||
| </group> | ||
| <footer> | ||
| <button name="translate_text" string="Translate" type="object" class="btn-primary"/> | ||
| <button string="Close" class="btn-secondary" special="cancel"/> | ||
| </footer> | ||
| </form> | ||
| </field> | ||
| </record> | ||
|
|
||
| <record id="action_translation_wizard" model="ir.actions.act_window"> | ||
| <field name="name">AI Translate</field> | ||
| <field name="res_model">translation.wizard</field> | ||
| <field name="view_mode">form</field> | ||
| <field name="target">new</field> | ||
| </record> | ||
|
|
||
| <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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
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.wizardis missing access rights. Without anir.model.access.csvfile, 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 asecurity/ir.model.access.csvfile for thetranslation.wizardmodel and adding it to thedatalist in this manifest file. This will ensure that users with the appropriate permissions can use the translation tool.