Skip to content

Commit

Permalink
Merge PR #1348 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Oct 17, 2024
2 parents 2c7fe66 + 4f925a5 commit 0851e20
Show file tree
Hide file tree
Showing 16 changed files with 715 additions and 0 deletions.
86 changes: 86 additions & 0 deletions project_tag_hierarchy/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
=====================
Project Tag Hierarchy
=====================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:8bc6b8773d35a27848dfa44a2d7533a65edb084565cce8858359ee2066497621
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Fproject-lightgray.png?logo=github
:target: https://github.com/OCA/project/tree/16.0/project_tag_hierarchy
:alt: OCA/project
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_tag_hierarchy
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/project&target_branch=16.0
:alt: Try me on Runboat

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

Hierarchy is added to the project labels.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/project/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/project/issues/new?body=module:%20project_tag_hierarchy%0Aversion:%2016.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
~~~~~~~

* Tecnativa

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

* `Tecnativa <https://www.tecnativa.com>`_:
* Víctor Martínez
* Pedro M. Baeza

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-victoralmau| image:: https://github.com/victoralmau.png?size=40px
:target: https://github.com/victoralmau
:alt: victoralmau

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

|maintainer-victoralmau|

This module is part of the `OCA/project <https://github.com/OCA/project/tree/16.0/project_tag_hierarchy>`_ 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 project_tag_hierarchy/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions project_tag_hierarchy/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2024 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Project Tag Hierarchy",
"version": "16.0.1.0.0",
"category": "Project Management",
"website": "https://github.com/OCA/project",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"depends": ["project"],
"installable": True,
"auto_install": True,
"data": [
"views/project_tags_views.xml",
],
"maintainers": ["victoralmau"],
}
45 changes: 45 additions & 0 deletions project_tag_hierarchy/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * project_tag_hierarchy
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-11 11:32+0000\n"
"PO-Revision-Date: 2024-10-11 13:33+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"X-Generator: Poedit 3.0.1\n"

#. module: project_tag_hierarchy
#: model:ir.model.fields,field_description:project_tag_hierarchy.field_project_tags__child_ids
msgid "Child Tags"
msgstr "Etiquetas hijas"

#. module: project_tag_hierarchy
#: model:ir.model.fields,field_description:project_tag_hierarchy.field_project_tags__parent_path
msgid "Parent Path"
msgstr "Ruta padre"

#. module: project_tag_hierarchy
#: model:ir.model.fields,field_description:project_tag_hierarchy.field_project_tags__parent_id
msgid "Parent Tag"
msgstr "Etiqueta padre"

#. module: project_tag_hierarchy
#: model:ir.model,name:project_tag_hierarchy.model_project_tags
msgid "Project Tags"
msgstr "Etiquetas del proyecto"

#. module: project_tag_hierarchy
#. odoo-python
#: code:addons/project_tag_hierarchy/models/project_tags.py:0
#, python-format
msgid "You can not create recursive tags."
msgstr "No puede crear etiquetas recursivas."
43 changes: 43 additions & 0 deletions project_tag_hierarchy/i18n/project_tag_hierarchy.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * project_tag_hierarchy
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-11 11:32+0000\n"
"PO-Revision-Date: 2024-10-11 11:32+0000\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: project_tag_hierarchy
#: model:ir.model.fields,field_description:project_tag_hierarchy.field_project_tags__child_ids
msgid "Child Tags"
msgstr ""

#. module: project_tag_hierarchy
#: model:ir.model.fields,field_description:project_tag_hierarchy.field_project_tags__parent_path
msgid "Parent Path"
msgstr ""

#. module: project_tag_hierarchy
#: model:ir.model.fields,field_description:project_tag_hierarchy.field_project_tags__parent_id
msgid "Parent Tag"
msgstr ""

#. module: project_tag_hierarchy
#: model:ir.model,name:project_tag_hierarchy.model_project_tags
msgid "Project Tags"
msgstr ""

#. module: project_tag_hierarchy
#. odoo-python
#: code:addons/project_tag_hierarchy/models/project_tags.py:0
#, python-format
msgid "You can not create recursive tags."
msgstr ""
3 changes: 3 additions & 0 deletions project_tag_hierarchy/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import project_tags
33 changes: 33 additions & 0 deletions project_tag_hierarchy/models/project_tags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2024 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError


class ProjectTags(models.Model):
_inherit = "project.tags"
_parent_store = True

parent_id = fields.Many2one(
comodel_name="project.tags", string="Parent Tag", index=True, ondelete="cascade"
)
child_ids = fields.One2many(
comodel_name="project.tags", inverse_name="parent_id", string="Child Tags"
)
parent_path = fields.Char(index=True, unaccent=False)

def name_get(self):
res = []
for tag in self:
names = []
current = tag
while current:
names.append(current.name)
current = current.parent_id
res.append((tag.id, " / ".join(reversed(names))))
return res

@api.constrains("parent_id")
def _check_parent_id(self):
if not self._check_recursion():
raise ValidationError(_("You can not create recursive tags."))
3 changes: 3 additions & 0 deletions project_tag_hierarchy/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `Tecnativa <https://www.tecnativa.com>`_:
* Víctor Martínez
* Pedro M. Baeza
1 change: 1 addition & 0 deletions project_tag_hierarchy/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hierarchy is added to the project labels.
Binary file added project_tag_hierarchy/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 0851e20

Please sign in to comment.