Skip to content
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

[15.0][MIG] base_translation_field_label #2689

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions base_translation_field_label/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
============================
Base Translation Field Label
============================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github
:target: https://github.com/OCA/server-tools/tree/13.0/base_translation_field_label
:alt: OCA/server-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-tools-13-0/server-tools-13-0-base_translation_field_label
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/149/13.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

This addon adds the field label on translated terms. Each translated term is
referencing an Odoo field, but the name stated there is not human readable at all,
instead, the field description is shown and the Translated field is hidden at first,
but it can be showed if needed.

**Table of contents**

.. contents::
:local:

Configuration
=============

Simply install the module, to access the Settings > Translations > Application Terms
> Translated Terms menu you need to have the Developer Mode enabled.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20base_translation_field_label%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* ForgeFlow

Contributors
~~~~~~~~~~~~

* `ForgeFlow S.L. <https://www.forgeflow.com>`_:

* Guillem Casassas <[email protected]>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-GuillemCForgeFlow| image:: https://github.com/GuillemCForgeFlow.png?size=40px
:target: https://github.com/GuillemCForgeFlow
:alt: GuillemCForgeFlow

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-GuillemCForgeFlow|

This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/13.0/base_translation_field_label>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions base_translation_field_label/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
18 changes: 18 additions & 0 deletions base_translation_field_label/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2023 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Base Translation Field Label",
"summary": """
Shows the field label and optionally hides the Translated field value.
""",
"version": "15.0.1.0.0",
"category": "Generic Modules/Base",
"license": "AGPL-3",
"website": "https://github.com/OCA/server-tools",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"depends": ["base"],
"data": ["views/ir_translation_views.xml"],
"maintainers": ["GuillemCForgeFlow"],
"installable": True,
"application": False,
}
29 changes: 29 additions & 0 deletions base_translation_field_label/i18n/base_translation_field_label.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_translation_field_label
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: base_translation_field_label
#: model:ir.model.fields,field_description:base_translation_field_label.field_ir_translation__field_label
msgid "Translated Field"
msgstr ""

#. module: base_translation_field_label
#: model:ir.model.fields,field_description:base_translation_field_label.field_ir_translation__value
msgid "Translated Value"
msgstr ""

#. module: base_translation_field_label
#: model:ir.model,name:base_translation_field_label.model_ir_translation
msgid "Translation"
msgstr ""
1 change: 1 addition & 0 deletions base_translation_field_label/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import ir_translation
22 changes: 22 additions & 0 deletions base_translation_field_label/models/ir_translation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2023 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models


class IrTranslation(models.Model):
_inherit = "ir.translation"

field_label = fields.Char(string="Translated Field", compute="_compute_field_label")

value = fields.Text(string="Translated Value")

@api.depends("name")
def _compute_field_label(self):
for it in self:
field_label = it.name
if it.name and "," in it.name and it.name.count(",") == 1:
model_name, field_name = it.name.split(",")
model = self.env.get(model_name)
if model is not None and field_name in model._fields:
field_label = model._fields[field_name].string
it.field_label = field_label
2 changes: 2 additions & 0 deletions base_translation_field_label/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Simply install the module, to access the Settings > Translations > Application Terms
> Translated Terms menu you need to have the Developer Mode enabled.
3 changes: 3 additions & 0 deletions base_translation_field_label/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `ForgeFlow S.L. <https://www.forgeflow.com>`_:

* Guillem Casassas <[email protected]>
4 changes: 4 additions & 0 deletions base_translation_field_label/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This addon adds the field label on translated terms. Each translated term is
referencing an Odoo field, but the name stated there is not human readable at all,
instead, the field description is shown and the Translated field is hidden at first,
but it can be showed if needed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading